60 lines
1.6 KiB
Bash
Executable File
60 lines
1.6 KiB
Bash
Executable File
#!/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
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
|
if [ -r /var/log/syslog ]; then
|
|
echo "yes"
|
|
else
|
|
echo "no (cannot read /var/log/syslog)"
|
|
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 AREA'
|
|
echo 'mail.min 0'
|
|
echo 'mail.draw LINE1'
|
|
echo 'ham.label ham'
|
|
echo 'ham.type DERIVE'
|
|
echo 'ham.min 0'
|
|
echo 'ham.draw LINE1'
|
|
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=`/bin/mktemp /tmp/munin-sa-XXXXXX`
|
|
egrep "spamd: (processing message|identified spam|clean message)" /var/log/syslog >> $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
|