[rrd-users] Calculating a 5%-rule

Geert van der Ploeg geert at triple-it.nl
Thu Feb 14 17:45:40 MET 2002

Hi all,

I'm implementing a sort of bandwidth-usage billing system, using RRDtool.

<short mode>
How to calculate what value is the highest, after ignoring the highest 5% ?
</short mode>

<long, informative mode>
The system should calculate costs using the 5%-rule, which is:
You don't have to pay for the highest 5% of the peaks of your usage

This is calculated using the following algorithm:
 - Sort the peaks on length (highest first)
 - Chop off the first (= highest) 5% of the values
 - The first value after that 5% is the rate used for billing.

Ok, implementing using RRD:
 - Getting the max value is no problem
 - Determining what values are the 5% highest

And that's where the problems starts...

I haven't got a clue how to do this..
For to accomplish it, I think would have to do rather complicated calculations across the data..
The only way doing cross-data calculations is using the PREV operator..
But that way I would have to remember the highest peak, and then traverse again, looking for the
second-highest, etc, until I've done 5% of the values...
But, you cannot remember those values...
Besides... it would be very slowly to do it this way.
</long, informative mode>

To make it short:
I got stuck thinking in that direction.

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

Using a sh/perl/php script parsing an "rrdtool fetch" would be another solution (i've already worked
that out), but that does not allow me to do the calculations spanning over multiple datasources,
multiple files
(for example: incoming as well as outgoing traffic...)

thx for reacting!


Geert van der Ploeg
Triple 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