%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /data/old/etc/munin/plugins/
Upload File :
Create Path :
Current File : //data/old/etc/munin/plugins/spamassassin

#!/bin/sh
#
# Plugin to count the SpamAssassin troughput
#
# Contributed by David Obando - 16.11.2005
#
#  2006.aug.21. - grin@grin.hu - fix autoconf, insecure tmp file
#               - added mail count
#               - save less irrelevant data into tmp
#               - requires in plugin-conf.d/munin-node (to access syslog):
#                 [spamassassin]
#                 group adm
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf
maillog=/var/log/maillog

if [ "$1" = "autoconf" ]; then
        if [ -r $maillog ]; then 
	        echo "yes"
        else
        	echo "no (cannot read $maillog)"
        fi
        exit 0
fi

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

        echo 'graph_title SpamAssassin stats'
        echo 'graph_args --base 1000 -l 0 '
        echo 'graph_vlabel  SpamAssassin mail/sec'
        echo 'graph_order spam ham'
        echo 'graph_category Mail'
        echo 'mail.label mail'
        echo 'mail.type DERIVE'
        echo 'mail.min 0'
        echo 'mail.draw LINE2'
        echo 'ham.label ham'
        echo 'ham.type DERIVE'
        echo 'ham.min 0'
        echo 'ham.draw LINE2'
        echo 'spam.label spam'
        echo 'spam.type DERIVE'
        echo 'spam.min 0'
        echo 'spam.draw AREA'
        exit 0
fi

# create a secure tmp file
TEMP=`/usr/bin/mktemp /tmp/munin-sa-XXXXXX`
egrep "spamd: (processing message|identified spam|clean message)" $maillog >> $TEMP

echo -n "mail.value " && grep "processing message" $TEMP | wc -l
echo -n "spam.value " && grep "identified spam" $TEMP | wc -l
echo -n "ham.value " && grep "clean message" $TEMP | wc -l

rm $TEMP


Zerion Mini Shell 1.0