Re: [EXIM] Monitoring EXIM throughput stats

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Nigel Metheringham
Dátum: 1998-11-25 10:00 -000
Címzett: markguz
CC: exim-users
Tárgy: Re: [EXIM] Monitoring EXIM throughput stats

markguz@??? said:
} I am trying to hack MRTG to monitor the in/out traffic levels on EXIM.
} I kind of have it working, but its a bit of a cludge which involves
} parsing the output of eximstat taking the total in and the total out ,
} subtracting the last reading i took and getting the 5min traffic
} level. This becomes even more fun when the counter resets at midnight.

Ugh. That really is cracking a walnut with a fleet of steam rollers....

Try something like this:-

#!/usr/bin/perl
#
use strict;
use File::Tail;

my $logfile = '/var/log/exim/main.log';

  { # main
    my $fh = File::Tail->new('name'        => $logfile,
                 'interval'        => 5,
                 'maxinterval'    => 20,
                 'resetafter'    => 60,
                 'adjustafter'    => 20)
      or
    die "Could not open $logfile: $!";


    my $in;
    my $out;
    while(defined($line = $fh->read())) {
    chomp($line);
        $in++ if (/ <= /);
        $out++ if (/ [=-*]> /);
        # do something with in/out count...
    }
  }


Final implementation is left as an exercise for the reader....

    Nigel.
-- 
[ Nigel.Metheringham@???   -  Systems Software Engineer ]
[ Tel : +44 113 207 6112                   Fax : +44 113 234 6065 ]
[      Real life is but a pale imitation of a Dilbert strip       ]
[ We're recruiting  http://www.theplanet.net/profile/recruit.htm  ]




--
*** Exim information can be found at http://www.exim.org/ ***