#!/bin/sh
#
# Return the traffic of qmail-smtpd
# 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/log/smtpl/

CMD="$DLOG qsmtp raw $LOGDIR"

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

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

        echo 'graph_title qmail-smtp connections'
        echo 'graph_args --base 1000 -l 0 '
        echo 'graph_vlabel connections'
        echo 'graph_category Mail'
        echo 'graph_order dqsm1'
        echo 'dqsm1.label Simultaneous connections'
        echo 'dqsm1.min 0'
        echo 'dqsm1.draw LINE2'
        exit 0

fi

OUTPUT=`$CMD`

echo -n "dqsm1.value " && echo "$OUTPUT" | grep MAXCON | cut -f 2 -d:


