#!/bin/sh
#
# Return the traffic of publicfile
# within the last 5 minutes
#
# By Rasmus Skaarup <dlog@gal.dk> - Aug 2006
#
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf

DLOG=/usr/local/dlog/bin/dodlog.pl
LOGDIR=/var/service/publicfile/log/main/

CMD="$DLOG publicfile raw $LOGDIR"

if [ "$1" = "autoconf" ]; then
        echo yes
        exit 0
fi

if [ "$1" = "config" ]; then

        echo 'graph_title publicfile traffic - pages served '
        echo 'graph_args --base 1000 -l 0 '
        echo 'graph_vlabel pages'
        echo 'graph_category WWW'
        echo 'graph_order dpub1 dpub2'
        echo 'dpub1.label Success'
        echo 'dpub1.min 0'
        echo 'dpub1.draw LINE2'
        echo 'dpub2.label Failures'
        echo 'dpub2.min 0'
        echo 'dpub2.draw LINE2'
        exit 0

fi

OUTPUT=`$CMD`

echo -n "dpub1.value " && echo "$OUTPUT" | grep SUCCESS | cut -f 2 -d:
echo -n "dpub2.value " && echo "$OUTPUT" | grep FAILURES | cut -f 2 -d:


