Present Location: News >> Blog >> mrtg-rrd and RRDtool 1.3.0

Blog

> mrtg-rrd and RRDtool 1.3.0
Posted by prox, from Charlotte, on June 28, 2008 at 21:59 local (server) time

You know me, I'm fairly old-school, so I use MRTG for all network monitoring.  Although I converted to RRDtool (rateup sucks) awhile back, I've still been sticking with the classic MRTG look via the mrtg-rrd CGI script.

FreeBSD ports upgraded RRDtool to 1.3.0 recently, and ended up breaking mrtg-rrd.  The mrtg-rrd page looked like this:

broken mrtg-rrd

It turned out the width and height (classic ol' HTML) parameters to the image tag were wrong.  width was being set to 8 or 0, and height was being set to an outrageously large number.  The image itself was intact, though.  mrtg-rrd was populating these values from the 2nd and 3rd array indices of the return value from RRDs::graph, $rv[0] and $rv[1]:

my @rv = RRDs::graph($file, '-s', "-$back", @local_args,
     @{$target->{args}}, "VRULE:$oldsec#ff0000",
     "VRULE:$seconds#ff0000", @local_args_end);

Bug in RRDtool?  Maybe.  Could be something that RRDtool linked against.  Anyway, the workaround is easy since the width and height are available from the config:

@@ -230,8 +230,8 @@
        return unless defined $tgt->{$ext};
 
        my @values = @{$params->[0]};
-       my $x = $params->[1];
-       my $y = $params->[2];
+       my $x = $tgt->{config}->{xsize};
+       my $y = $tgt->{config}->{ysize};
 
        $x *= $tgt->{xzoom} if defined $tgt->{xzoom};
        $y *= $tgt->{yzoom} if defined $tgt->{yzoom};

Now graphs are looking better, again.

Comment by blake on June 29, 2008 at 05:37 local (server) time

Thanks, this was extremely helpful!

Comment by Todd on December 31, 2008 at 21:57 local (server) time

So, I have MRTG and RRDTool installed on a new Fedora 10 system and RRDTool seems to be broken on it, too. I don't get the values under the graphs but only every 5 minutes or so. Anyone else having this problem? Stems from RRDs::graph not returning the data but only so often.

Comment by Mark Kamichoff [Website] on January 01, 2009 at 01:32 local (server) time

Yeah, I get that too.  I'm not sure why it's doing that, I honestly haven't looked into it too much...


> Add Comment

New comments are currently disabled for this entry.