[Mimedefang] Mail stats via rrdtool

Fredrik Hansen fredrik.hansen at dataservice.mine.nu
Mon Jan 19 10:06:14 EST 2004


On Mon, 19 Jan 2004, Kayne Kruse wrote:

> > 
> > Suggestions, improvements anyone?
> > 
> > Best Regards,
> > Fredrik Hansen
> 
> I'd like a copy of your polling script for cacti. ;D
> 
Sure, its below:
Be sure to modify your MDLOG tags so they match.
Then call the script like: mail.pl /var/log/maillog
/Fredrik

#!/usr/bin/perl
use POSIX qw(strftime);
my $mail_counter = 0;
my $spam_counter = 0;
my $virus_counter = 0;

$date = strftime "%b %e %H:", localtime;
  while (<>) {
    if (m|$date|) {
     if ($_ =~ /mail_in/){
     $mail_counter++;
     }
     if ($_ =~ /spam/){
     $spam_counter++;
     }
     if ($_ =~ /virus/){
     $virus_counter++;
     }
   } else {
   }
 }
printf("mail_in:%d mail_spam:%d 
mail_virus:%d",$mail_counter,$spam_counter,$virus_counter);



More information about the MIMEDefang mailing list