[rrd-users] Re: Calculating a 5%-rule

Jason Fesler jfesler at gigo.com
Thu Feb 14 18:08:42 MET 2002


> Does anyone have a creative idea about which direction to think about?

Until someone can put %tile's into rrdtool's math parser..   I believe the
only way to do it today is to scan your existing data, ala fetch, and do
the math yourself.

In the archives for the list, somene suggested using
Statistics::Descriptive ; this was a great suggestion, but the methods
they used were too slow (adding each value in one at a time) because the
perl module update a lot of internal values after every call to it.

I now fetch the entire row of data, then feed it in one shot to
Statistics::Descriptive.  I could have also done it myself by hand,
without much effort, at this point.

use Statistics::Descriptive;
use RRDs;

...

($start,$step,$ds,$data) =
 RRDs::fetch($in,"AVERAGE","-s","-30d","-e","now");
 foreach (@$data) {
      next unless length($_->[0]);
      push(@p,$_->[0] || 0);
      push(@b,$_->[1] || 0);
 }
 $stat_packets = Statistics::Descriptive::Full->new();
 $stat_bytes = Statistics::Descriptive::Full->new();
 $stat_packets->add_data(@p);
 $stat_bytes->add_data(@b);
 $p = $stat_packets->percentile(95);
 $b = $stat_bytes->percentile(95);


You'll have to forgive the ugly coding style - this was a quick and dirty
script for me, so that I can keep the colo provider honest (as well as have
a realistic expectation of my next bill).   I run this once a minute
currently, though I am likely to reduce that down to once every 15 minutes
after I am satisfied with it.



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