[rrd-users] Summing over a range?

Aaron B. Iba aiba at bbn.com
Mon Jul 7 21:19:04 MEST 2003


Hi All,

I have about a thousand RRD files, one for each IP addresss inside our
network.  I'd like to be able to sort these IPs by "total" traffic over
a period of time (to see which IPs are using the most traffic). 
Currently I have a cgi script that calls RRDs::fetch and sums all the
data points by hand, but with 1000 RRD files, this is way too slow.  How
can I do it faster?  I tried playing with the --resolution switch, but I
could not ever get it to return data in anything but the finest
resolution.

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

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?

Thanks!

-Aaron


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