[mrtg] perl script
Herman Cremer
news at solidliquid.com
Thu Jun 21 15:29:30 MEST 2001
As far as the manuals go,
it is said that if a script returns 4 lines with values,
MRTG should use these values for graphing.
However, this little script should take an Exim mail server's logfile,
process it, then return two values:
1) IN per hour
2) OUT per hour
This does not work.
When I run the perl script manually with ./script, it returns two values,
but when MRTG accesses the script, no data is being fed through.
When I look at the .old file in the WORKDIR, values are displayed on the
first line, but thats it !!
Any help would be appreciated.
-------------------------------------
#!/usr/bin/perl
#Get the date & some time
$tdate = `date +%Y-%m-%dx%H:`;
#Remove unwanter Starting And ending strings.
$tdate =~ s/^\s+//;
$tdate =~ s/\s+$//;
#Construct 'space' in date
substr($tdate, 10, 1) = " ";
$input = `grep "$tdate" "/var/log/exim/exim_mainlog" | grep -c ">"`;
$output= `grep "$tdate" "/var/log/exim/exim_mainlog" | grep -c "<"`;
$I = int($input);
$O = int($output);
print "$I\n";
print "$O\n";
-----------------------------------------
____________________
Herman A Cremer
Systems Engineer &
Developer
SolidLiquid Pty Ltd
South Africa
+27 (0) 12 665 0636
____________________
--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive http://www.ee.ethz.ch/~slist/mrtg
FAQ http://faq.mrtg.org Homepage http://www.mrtg.org
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the mrtg
mailing list