[rrd-users] Re: Summing over a range?

Alex van den Bogaerdt alex at ergens.op.het.net
Tue Jul 8 09:30:33 MEST 2003


On Mon, Jul 07, 2003 at 03:19:04PM -0400, Aaron B. Iba wrote:

> Here is roughly what I do, for each RRD file, to find the totals:
> 
>     my ($start,$step,$names,$data) =
> 	RRDs::fetch("$rrdfile",
> 		    "AVERAGE",
> 		    "-s $start",
> 		    "-e $end");
>     
>     foreach my $line (@$data) {
> 	$in += (@$line)[0] || 0;
> 	$out += (@$line)[1] || 0;
> 	$junk += (@$line)[2] || 0;
>     }

You left the values of "$start" and "$end" out.  These are important,
they should match the RRD used.

> I imagine this is a common thing that people do: compute totals over a
> range for an RRD file.  Anyone have some tips on how I can speed things
> up?

use "rrdtool graph" without any graphing options but with "PRINT" (not GPRINT)
to give you the averages.  No need to calculate these yourself.

Use the RRA with the lowest resolution possible.  Make sure both start and
end time are on a boundary suitable for that RRA.  This usually means you
have to think in UTC.

HTH,
Alex
-- 
Received on my linux server: "Increase the speed of your PC in minutes! Stop
windows from crashing, improve internet security and optimize your computers
performance with just a few easy mouse clicks!"

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