On Wed, 2009-06-17 at 14:05 -0500, Jared Hoskinson wrote:
Hello all
I need to alarm on bandwidth thresholds so I have added bbmrtg.pl
using this guide, http://www.pleiades.com/mrtgbb/. Everything is working expect when bbmrtg.pl runs it reports "In: bytes/sec (0.0%) Out: bytes/sec (0.0%)". When look at the graph produced by mrtg-rrd.cgi, it reports the correct usage which in case is "Current In: 68.8 Mb/s Current Out: 25Mb/s". It is as if bbmrgt.pl is not reading the rrd file.
It's a timing problem - the rrd is being written after bbmrtg reads it, so it's returning NaN.
I had to add a call to RRDs::last to make it work right: } elsif ($BACKEND eq 'RRD') { $last = RRDs::last($targetLog); my $first = $last - 300; my ($start, $step, $names, $data) = RRDs::fetch "-s $first","-e $last", $targetLog, 'AVERAGE'; foreach my $dat (@$data) { if (defined($$dat[0])) { $i_now=($factor * $$dat[0]); } if (defined($$dat[1])) { $o_now=($factor * $$dat[1]); } }
warn "last: $last, i_now: $i_now, o_now: $o_now\n" if $tron;
Sorry, I don't have the original code to do a proper diff...
-- Daniel J McDonald, CCIE # 2495, CISSP # 78281, CNX www.austinenergy.com