#!/bin/sh
#
# Return the traffic of axfrdns
# within the last 5 minutes
#
# By Rasmus Skaarup <rasmus@skaarupaps.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/axfrdns/log/main/

CMD="$DLOG axfrdns raw $LOGDIR"

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

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

        echo 'graph_title axfrdns traffic'
        echo 'graph_args --base 1000 -l 0 '
        echo 'graph_vlabel requests/queries'
        echo 'graph_category DNS'
        echo 'graph_order daxf1 daxf2 daxf3'
        echo 'daxf1.label Transfer'
        echo 'daxf1.min 0'
        echo 'daxf1.draw LINE2'
        echo 'daxf2.label Disallowed'
        echo 'daxf2.min 0'
        echo 'daxf2.draw LINE2'
        echo 'daxf3.label Fatal'
        echo 'daxf3.min 0'
        echo 'daxf3.draw LINE2'
        exit 0

fi

OUTPUT=`$CMD`

echo -n "daxf1.value " && echo "$OUTPUT" | grep TRANSFERS | cut -f 2 -d:
echo -n "daxf2.value " && echo "$OUTPUT" | grep DISALLOWED | cut -f 2 -d:
echo -n "daxf3.value " && echo "$OUTPUT" | grep FATAL | cut -f 2 -d:


