Första comitten av mina egna munin-plugins.
This commit is contained in:
59
spamassassin
Executable file
59
spamassassin
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/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 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=`/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
|
||||
Reference in New Issue
Block a user