1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-23 06:35:42 +00:00

Works better in debian

This commit is contained in:
rikr 2011-02-11 11:27:43 +01:00 committed by Steve Schnepp
parent 4f1ea21980
commit 31ee54bb73

View file

@ -9,6 +9,15 @@
# commands needed: logtail - grep # commands needed: logtail - grep
# #
# #
# Configuration:
# Maybe need to add folowing lines to plugins config file
# (e.g. /etc/munin/plugin-conf.d/pure-ftpd) to run pure-ftpwho
# as user with apropirate privilegs then restart munin-node.
#
# [pure-ftpd-bw]
# user root
#
#
# Parameters # Parameters
# #
# config (required) # config (required)
@ -27,43 +36,45 @@ OFFSET_FILE=/var/lib/munin/plugin-state/pure-ftpd-bw.offset
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -f $LOGFILE ]; then if [ -f $LOGFILE ]; then
if [ ! -z "$LOGTAIL" -a -f $LOGTAIL -a -x $LOGTAIL ]; then if [ ! -z "$LOGTAIL" -a -f $LOGTAIL -a -x $LOGTAIL ]; then
echo yes echo yes
exit 0 exit 0
else else
echo "no (logtail not found)" echo "no (logtail not found)"
exit 1 exit 1
fi fi
else else
echo "no (logfile $LOGFILE does not exist)" echo "no (logfile $LOGFILE does not exist)"
exit 1 exit 1
fi fi
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title Pure Ftpd Bandwidth' echo 'graph_title Pure Ftpd Bandwidth'
echo 'graph_args --base 1000 -l 0' echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel Datas sent / received' echo 'graph_vlabel Datas sent / received'
echo 'graph_category pure-ftpd' echo 'graph_category pure-ftpd'
echo 'dl.label Bytes downloaded' echo 'dl.label Bytes downloaded'
echo 'ul.label Bytes uploaded' echo 'ul.label Bytes uploaded'
exit 0 exit 0
fi fi
TMP1=`mktemp` TMP1=`mktemp`
if [ -f $TMP1 ]; then if [ -f $TMP1 ]; then
$LOGTAIL -o $OFFSET_FILE $LOGFILE | grep 'GET \|PUT ' > $TMP1 $LOGTAIL -o $OFFSET_FILE -f $LOGFILE | grep 'GET \|PUT ' > $TMP1
dls=$(awk '/GET / {print $9}' $TMP1) dls=$(awk '/GET / {print $9}' $TMP1)
dl=0 dl=0
for d in $dls; do dl=$(expr $dl + $d); done for d in $dls; do dl=$(expr $dl + $d); done
echo "dl.value ${dl}" echo "dl.value ${dl}"
uls=$(awk '/PUT / {print $9}' $TMP1) uls=$(awk '/PUT / {print $9}' $TMP1)
ul=0 ul=0
for u in $uls; do ul=$(expr $ul + $u); done for u in $uls; do ul=$(expr $ul + $u); done
echo "ul.value ${ul}" echo "ul.value ${ul}"
rm $TMP1 rm $TMP1
else else
echo "cant write temp file" echo "cant write temp file"
exit 1 exit 1
fi fi