yeah, the bash stuff is seriously vile and I'll be fixing it ASAP. I'd like to figure out and use db::tie, but failing that I'll optimize grep and awk to do one pass instead of four. The other thing is that I only care about two fields, so I've deleted the clean and processed lines.
On Thu, 2003-10-16 at 12:01, Joerg Mertin wrote: > Hmmm, > > couldn't use that one at work. The mail.info file growse about 5 GBytes/Day - > so all 5 inutes parsing 4 times through that file would kill the server. > I'd rather add logtail, and redefine the Options. > > Same for apache logs etc. :) > > Cheers > > Joerg > > On Thursday 16 October 2003 18:52, Jack Coates wrote: > > Made some modifications to an existing script set. I was trying to > > extend pfixmrtg but had a lot of trouble with the bdb stuff. > > > > 1) put this kludgy mofo into /usr/local/sbin/spam-stats > > #!/bin/bash > > # > > # spam-stats -- print counts of clean and spammy messages > > # from spamassassin. > > > > echo -e "spam:" `grep "identified spam" /var/log/mail/info | wc -l` > > echo -e "clean:" `grep "clean message" /var/log/mail/info | wc -l` > > echo -e "skipped:" `grep "skipped large" /var/log/mail/info | wc -l` > > echo -e "total:" `grep "spamd[[0-9]*]: connection from" > > /var/log/mail/info | wc -l` > > echo -e "processed:" `grep "processing message" /var/log/mail/info | wc > > -l` > > > > 2) put this less kludgy attachment into /usr/local/sbin/spamstats.pl. > > > > 3) edit your mrtg.cfg and add something like: > > # show number of messages that were spam, total number of > > # messages _processed_ by spamd > > Target[spam]: `/usr/local/sbin/spamstats.pl localhost spam` > > Directory[spam]: felix > > MaxBytes[spam]: 100000 > > Options[spam]: gauge, nopercent, growright > > Title[spam]: Spam Statistics > > PageTop[spam]: <H1>SA-identified spam, SA-processed email</H1> > > WithPeak[spam]: dwmy > > YLegend[spam]: No. of messages > > ShortLegend[spam]: messages > > LegendI[spam]: spam: > > LegendO[spam]: total: -- Jack Coates Monkeynoodle: A Scientific Venture...
Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com