[mrtg] Re: MRTG not graphing results?

Koelstra, J. (Jan) JKoelstra at MINSZW.NL
Wed Dec 17 10:27:07 MET 2003


John,

It seems the hitrate is very low. You can try perminute or even perhour
at the options line.

Hth,

Jan.

-----Original Message-----
From: John Oliver [mailto:joliver at john-oliver.net] 
Sent: Wednesday, December 17, 2003 10:17 AM
To: mrtg at list.ee.ethz.ch
Subject: [mrtg] MRTG not graphing results?


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



Het ministerie van Sociale Zaken en Werkgelegenheid sluit elke aansprakelijkheid uit in verband met het niet juist, onvolledig of niet tijdig overkomen van de informatie in deze e-mail. 
Aan dit bericht kunnen geen rechten worden ontleend. 

Dit bericht is alleen bestemd voor de geadresseerde. Indien dit bericht niet voor u bestemd is, verzoeken wij u dit onmiddellijk aan ons te melden en de inhoud van het bericht te vernietigen. 
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The ministry of Social Affairs and Employment is not liable for any incorrect or incomplete transmission of the information in this e-mail or for any delay in its receipt. 
This message shall not constitute any obligations.

This message is intended solely for the addressee.
If you have received this message in error, please inform us immediately and delete its content.

--
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