[mrtg] MRTG not graphing results?
John Oliver
joliver at john-oliver.net
Wed Dec 17 10:16:53 MET 2003
Machine is Red Hat 7.2 MRTG 2.9.17
Using Apache stuff from http://www.linux-sottises.net/en_mrtg.php
Config file:
WorkDir: /home/www/sdsitehosting.com/mrtg/
Interval: 10
Target[apache-hits]: `/usr/local/mrtg-2/bin/webstat.pl hits`
Options[apache-hits]: growright, nopercent
MaxBytes[apache-hits]: 10000
Title[apache-hits]: sdsitehosting.net Apache hits
PageTop[apache-hits]: <H1>sdsitehosting.net Apache hits</H1>
YLegend[apache-hits]: Hits/10 min.
ShortLegend[apache-hits]: hits/10 min
Colours[apache-hits]: YELLOW#F9C000,RED#F90000,DARK
GREEN#006600,VIOLET#FF00FF
Legend1[apache-hits]: Hits
LegendI[apache-hits]: hits:
LegendO[apache-hits]:
[joliver at ns joliver]$ cat /usr/local/mrtg-2/bin/webstat.pl
#!/usr/bin/perl
@res = `lynx -dump http://localhost:80/server-status`;
foreach $res (@res) {
if ($res =~ /Server uptime: (.*)$/) { $up = $1; last } else { next }
if ($res =~ /Server at/) { $server = $res; last } else { next }
}
@res = `lynx -dump http://localhost:80/server-status?auto`;
foreach $res (@res) {
if ($res =~ /Total Accesses: (\d+)/) { $d1 = $1; next }
if ($res =~ /Total kBytes: (\d+)/) { $d2 = $1 * 1024; next }
}
$d1 = int($d1);
$d2 = int($d2);
if ($ARGV[0] eq "hits") {
print "$d1\n";
print "$d1\n";
} elsif ($ARGV[0] eq "bytes") {
print "$d2\n";
print "$d2\n";
}
print "$up\n";
print "$server";
/usr/local/mrtg-2/bin/webstat.pl does return valid-looking results:
[joliver at ns joliver]$ /usr/local/mrtg-2/bin/webstat.pl hits
1514
1514
3 hours 35 minutes 8 seconds
MRTG does seem to read those results:
[joliver at ns joliver]$ head -10
/home/www/sdsitehosting.com/mrtg/apache-hits.log
1071651614 1433 1433
1071651614 0 0 0 0
1071651005 0 0 0 0
1071651000 0 0 2 2
1071650700 0 0 2 2
1071650400 0 0 0 0
1071650100 0 0 0 0
1071649800 0 0 1 1
1071649500 0 0 0 0
1071649200 0 0 0 0
After it runs:
[joliver at ns joliver]$ head -10
/home/www/sdsitehosting.com/mrtg/apache-hits.log
1071652206 1518 1518
1071652206 0 0 0 0
1071651614 0 0 0 0
1071651600 0 0 0 0
1071651300 0 0 0 0
1071651000 0 0 2 2
1071650700 0 0 2 2
1071650400 0 0 0 0
1071650100 0 0 0 0
1071649800 0 0 1 1
But nothing ever gets graphed.
--
John Oliver, CCNA http://www.john-oliver.net/
Linux/UNIX/network consulting http://www.john-oliver.net/resume/
* * * * * * * * * * * * * * *
Contribute to the SpamCon Legal Fund!! http://www.spamcon.org/legalfund/
--
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