[rrd-users] Mismatch in MAX values

Scott Williams swilliams at skyriver.net
Thu Jul 31 01:40:26 MEST 2003


I written a Perl script that graps the MAX input and output values from
an rrd file, but 
values that it gets does not match up with the graphs for the device.
I'm new at Perl,
but I believe the logic is sound.  Here's the script that I wrote along
with the vales that
I get when I run it.  I'll also but the values that I get from the
graph.  Any help with this 
would be much appreciated.


#!/usr/bin/perl -w
$t_days = $ARGV[0];
$t_watch = 60 * 60 * 24 * $t_days; 
$now = time();
$start = $now - $t_watch;

open(RRD,"rrdtool fetch ethernet.rrd MAX --start $start |") or die
"Can't open rrdtool";

$in_max = 0;
$out_max = 0;
while(<RRD>) {
    chomp;
    ($time,$stuff) = split /:\s+/;
    @ds = split /\s+/, $stuff;
    $new_bits_in = $ds[0];
    $new_bits_out = $ds[1];

    $cur_bits_in = ($new_bits_in - $old_bits_in) * 8;
    $cur_bits_out = ($new_bits_out - $old_bits_out) * 8;

    if($cur_bits_in > 0) {
        $in_max=($in_max > $cur_bits_in) ? $in_max : $cur_bits_in;
    }
    if($cur_bits_out > 0) {
        $out_max=($out_max > $cur_bits_out) ? $out_max : $cur_bits_out;
    }

    $old_bits_in = $new_bits_in;
    $old_bits_out = $new_bits_out;
}

$in_max = sprintf("%.2f", $in_max / (1024 * 1024));
$out_max = sprintf("%.2f", $out_max / 1024); * 1024));

print  "INPUT MAX: $in_max\n";
print  "OUTPUT MAX: $out_max\n";


noc# INPUT MAX: 1.10
noc# OUTPUT MAX: 0.38

On the Graphs I can see input max at 1.91 and output at 0.54


Scott Williams
Network Analyst
Skyriver Communications, Inc.
Office: (858)812-5292
Cell: (858)945-6761
 

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list