Simon Byrnand wrote to jdow and [EMAIL PROTECTED]:
> I wouldn't mind graphing our global mailserver spam statistics using
> mrtg to see these trends, does anyone know of any scripts that can do
> that ? I'm using sendmail with procmail and spamc/spamd.
Yes. It's actually quite easy if you're using the milter. (Or anything
that can write the Spam-Status to syslog, actually :-)
#!/bin/sh
/usr/bin/grep "X-Spam-Status: Yes" /var/log/maillog | /usr/bin/wc -l |
/usr/bin/awk '{print $1}'
/usr/bin/grep "X-Spam-Status: No" /var/log/maillog | /usr/bin/wc -l |
/usr/bin/awk '{print $1}'
uptime | awk '{ print $3, $4, $5, $6, $7, $8, $9, $10, $11, $12 }'
echo "SaskNow Spam vs. Ham"
Even that is overkill.. I could have done without awk, I suppose. :-)
There's a small chance that my naive grep will result in some FPs, but
that's also easy to beef up. Whaddya want for five minutes on a lunch
break? :-)
In mrtg.cfg:
# Spam vs Ham
Target[spam]: `/path/to/above/script.sh`
Maxbytes[spam]: 10000
Title[spam]: SPAM vs. HAM messages
PageTop[spam]: SPAM vs. HAM messages
ShortLegend[spam]: Msgs/hr
YLegend[spam]: SPAM/HAM
Legend1[spam]: SPAM messages
Legend2[spam]: HAM messages
LegendI[spam]: SPAM messages
LegendO[spam]: HAM messages
Options[spam]: perhour
The result is a graph of ham (blue) and spam (green), in messages per hour.
- Ryan
--
Ryan Thompson <[EMAIL PROTECTED]>
SaskNow Technologies - http://www.sasknow.com
901-1st Avenue North - Saskatoon, SK - S7K 1Y4
Tel: 306-664-3600 Fax: 306-244-7037 Saskatoon
Toll-Free: 877-727-5669 (877-SASKNOW) North America