[rrd-users] New operator to CDEF proposal

Glenn MacGregor gtm at highstreetnetworks.com
Wed Jan 22 18:00:22 MET 2003

```Hi All,

I have not been using rrdtool for too long, so this maybe unnecessary, if so tell me know how I can do it with the existing operators.

I am trying to calculate availability for a device based on a true or false value.  The availability is a percentage 0 - 100%.  The only way I can think of to calculate it would be:

((Total # samples * (endtime - starttime)) - (# of false samples * (endtime - starttime)) / (Total # samples * (endtime - starttime))) * 100

Example:
Ten samples every 5 minutes
Time        Value        Availability        Function
---------    -----------        --------------        --------------
0                1                100%          ((1*(0-0))-(0*(0-0))/(1*(0-0))*100               (Could be a problem here Div by 0)
5                1                100%          ((2*(5-0))-0/2*(5-0)*100 = 100
10              1                100%
15              1                100%
20              0                80%            (5*20)-(1*20)/(5*20) = 80/100 = .8 * 100 = 80%
25              1                83.3%
30              0                71.4%
35              0                62.5%
40              1                66.7%
45              1                70.0%
50              0                63.7%

Is there a way to do this in the current CDEF?  If not I can add it to the list of functions if you think this is the correct way to do something like this?

Or is there another way to make this happen within rrd?