plugin-spamassassin: spamassassin.2

File spamassassin.2, 1.6 kB (added by grin <grinapo@gmail.com>, 4 years ago)

Plugin (for syslog) updates: security, docs, mailcount, less IO

Line 
1 #!/bin/sh
2 #
3 # Plugin to count the SpamAssassin troughput
4 #
5 # Contributed by David Obando - 16.11.2005
6 #
7 #  2006.aug.21. - grin@grin.hu - fix autoconf, insecure tmp file
8 #               - added mail count
9 #               - save less irrelevant data into tmp
10 #               - requires in plugin-conf.d/munin-node (to access syslog):
11 #                 [spamassassin]
12 #                 group adm
13 #
14 # Magic markers - optional - used by installation scripts and
15 # munin-config:
16 #
17 #%# family=manual
18 #%# capabilities=autoconf
19
20 if [ "$1" = "autoconf" ]; then
21         if [ -r /var/log/syslog ]; then
22                 echo "yes"
23         else
24                 echo "no (cannot read /var/log/syslog)"
25         fi
26         exit 0
27 fi
28
29 if [ "$1" = "config" ]; then
30
31         echo 'graph_title SpamAssassin stats'
32         echo 'graph_args --base 1000 -l 0 '
33         echo 'graph_vlabel  SpamAssassin mail/sec'
34         echo 'graph_order spam ham'
35         echo 'graph_category Mail'
36         echo 'mail.label mail'
37         echo 'mail.type DERIVE'
38         echo 'mail.min 0'
39         echo 'mail.draw LINE2'
40         echo 'ham.label ham'
41         echo 'ham.type DERIVE'
42         echo 'ham.min 0'
43         echo 'ham.draw LINE2'
44         echo 'spam.label spam'
45         echo 'spam.type DERIVE'
46         echo 'spam.min 0'
47         echo 'spam.draw AREA'
48         exit 0
49 fi
50
51 # create a secure tmp file
52 TEMP=`/bin/mktemp /tmp/munin-sa-XXXXXX`
53 egrep "spamd: (checking message|identified spam|clean message)" /var/log/syslog >> $TEMP
54
55 echo -n "mail.value " && grep "checking message" $TEMP | wc -l
56 echo -n "spam.value " && grep "identified spam" $TEMP | wc -l
57 echo -n "ham.value " && grep "clean message" $TEMP | wc -l
58
59 rm $TEMP