I installed the Perl Module like you suggested and twiked my code a bit and it's now running much better. I'm still a little confused why I was getting such different results from the fetch command and my graphs, but at least now I'm getting the correct values. Thanks for the help.
Scott -----Original Message----- From: Warnes, Jason SktnHR [mailto:[EMAIL PROTECTED] Sent: Friday, August 01, 2003 3:25 PM To: Scott Williams; rrd-users@list.ee.ethz.ch Subject: RE: [rrd-users] Mismatch in MAX values I haven't seen a reply on this post yet, so I thought I'd throw in my two cents. I do a similar thing for some Terminal Server graphs I generate. Here is a bit of my code snippet: ---- Start Snippet ---- use RRDs; # Get a week's worth of points from the MAX RRA of termserver.rrd my ($start,$step,$names,$data)=RRDs::fetch("termserver.rrd","MAX","--start" ,"-6 04800"); # Zero out all the variables $maxweekconnections=0; $maxweekdate=0; # Find the max connections and time foreach my $line (@data) { foreach my $val (@$line) { # Check each value # Check to see if this connection count is higher than # the last highest that was found if($maxweekconnections<=$val){ # Store the MAX value for the week $maxweekconnections=$val; # Store the date when the MAX value happened $maxweekdate=$start; } } # Add the step time to the start to keep track # of what date we're looking at $start+=$step; } # Convert the epoch time to something more readable $readablemaxweekdate=localtime($maxweekdate); print("Max connections for the week happened on $readablemaxweekdate with $maxweekconnections.\n); ---- End Snippet ---- I notice in your Perl script you're doing system calls to get the RRD FETCH function to work. Have you tried using the RRDs Perl module? My code above uses that and I haven't had any grief getting maximum values. Just thought it might be worth a try. Jason... -----Original Message----- From: Scott Williams [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 30, 2003 5:40 PM To: rrd-users@list.ee.ethz.ch Subject: [rrd-users] Mismatch in MAX values 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:[EMAIL PROTECTED] Help mailto:[EMAIL PROTECTED] Archive http://www.ee.ethz.ch/~slist/rrd-users WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi -- Unsubscribe mailto:[EMAIL PROTECTED] Help mailto:[EMAIL PROTECTED] Archive http://www.ee.ethz.ch/~slist/rrd-users WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi