[rrd-users] Re: Calculate area from graph?

Warnes, Jason SDH warnesj at sdh.sk.ca
Mon May 27 20:05:50 MEST 2002


You could try running a fetch for the week and add up all the bytes that are
>1Mbps.  If you're using Perl it would be something like this:
	Assuming: You have the RRD shared module loaded in Perl
	          Your file is called 'bandwidth.rrd' for example purposes

---Start Code---
# Fetch a week's worth (604800 seconds) of data from bandwidth.rrd
my
($start,$step,$names,$data)=RRDs::fetch("bandwidth.rrd","AVERAGE","--start=-
604800");
# Reset the over limit count to zero
$totalover1Mbps=0;
# Examine each line returned from the fetch
foreach my $line (@$data) {
	# Examine each value on each line returned by the fetch
	foreach my $val (@$line) {
		if($val > 1000000) {	# The value is greater that 1Mbps
			# Add the amount over 1Mbps to a total over counter
			$totalover1Mbps=$totalover1Mbps+($val-1000000);
		}
	}
}
---End Code---

Then you should have a scalar called $totalover1Mpbs that you should be able
to include in a comment on the graph somewhere.  I have to warn you, I'm
pretty new at Perl so this might not be the most efficient way of doing
things

Just a thought.

Jason...

-----Original Message-----
From: Fredrik X [mailto:fredrik at pulsesoft.com] 
Sent: May 27, 2002 1:23 AM
To: rrd-users at list.ee.ethz.ch
Subject: [rrd-users] Calculate area from graph?


Hello, 

Im having some trouble with the graph...

I've attached a graph that shows all peaks over 1mbps with a gray area, is
it possible to calculate this area? The result should be total bytes
transferred during these peaks.

//Fredrik


-- Attached file removed by Listar and put at URL below --
-- Type: image/gif
-- Size: 18k (18741 bytes)
-- URL : http://www.ee.ethz.ch/~slist/pantomime/monitor.gif


--
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

--
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