[mrtg] I give up, how do you make mrtg work?

Geoff Sweet geoff.sweet at wemadeusa.com
Sat Mar 20 20:29:24 CET 2010


For two days I have fought and fought to make MRTG produce graphs that make any kind of sense and I am now stuck.  I have basically built a mock-up so as to remove any unknown aspect of fetching data from my server.

I started with a small script that emulates exactly the data I am getting. I am using bwm-ng on OpenBSD to give me rate values for the network interface that is in bytes/sec.  I mocked a perl script up to produce that output for now:

use strict;

my $pad1 = 2905701 + int(rand(1000));
my $pad2 = 1126298 + int(rand(1000));
 
print $pad1."\n".$pad2."\n";
print "0\n";
print "0\n";

and the output looks like this:

# perl /usr/local/wemade/get_fw_bw.pl 
2906330
1127083
0
0

I added in the rand part so I could see some small fluctuation.  But 2905701 in bytes/sec should be about (2905701 X 8) 23245608 bits/sec or about 23Mb/sec.  I feed that in via my mrtg config:

HtmlDir: /var/www/html/prodstats/firewall
ImageDir: /var/www/html/prodstats/firewall
LogDir: /var/lib/mrtg
ThreshDir: /var/lib/mrtg
Title[fw_total]: Firewall Total Bandwidth
PageTop[fw_total]: <H1>Firewall Total Bandwidth</H1>
Options[fw_total]: growright
Target[fw_total]: `/usr/bin/perl /usr/local/wemade/get_fw_bw.pl`
YLegend[fw_total]: Bandwidth
MaxBytes[fw_total]: 32768000

and after now several iterations my chart says

 Max  	Average  	Current
In 	8.0 B/s (0.0%) 	9.0 B/s (0.0%) 	9.0 B/s (0.0%)
Out 	12.0 B/s (0.0%) 	12.0 B/s (0.0%) 	12.0 B/s (0.0%) 

and the logfile looks like this:

# head /var/lib/mrtg/fw_total.log 
1269113161 2906169 1126931
1269113161 5 5 5 5
1269113102 11 5 11 5
1269113100 8 12 158 105
1269112800 0 0 0 0
1269112500 0 0 0 0
1269112200 0 0 0 0
1269111900 0 0 0 0
1269111600 0 0 0 0
1269111300 0 0 0 0


I don't get it.  Anyone have any ideas?

-Geoff Sweet


More information about the mrtg mailing list