[rrd-developers] A Patch: NaN-proof Averaging

Chris Snell cjs+lists at aol.net
Mon Nov 19 17:30:54 MET 2001

Hi All,

Here is a patch to generate averages in a CDEF that are not susceptible to
breaking when a NaN is present in the values being averaged.

Background:  I was given a requirement to generate utilization graphs that
show an average metric for entire farms of machines (anywhere from 10 to
300+ boxes).  I was having problems: if one of the machines went offline
for some reason, its metrics would register as NaN.  When I tried to
average them all, the result would be, of course, NaN.  I needed a way to
discard all NaN's from a set of values and average the remaining real
numbers.  Since we're dealing with large data sets here, its not a big
deal if a few measurements are removed from the average because they were

Implementation:  I added a new RPN function: AVGNONAN.  This function
pulls all values from the stack, discards NaN values and averages the
remainder, pushing the result back onto the stack.



The patch is attached to this e-mail.  Comments and suggestions will be
much appreciated.
 Christopher Snell < cjs _at_ AOL . net >
 Systems Architect / R&D / Web Infrastructure / AOL
 /* privat: http://chrissnell.com */

-- Attached file removed by Listar and put at URL below --
-- Type: text/plain
-- Size: 2k (2839 bytes)
-- URL : http://www.ee.ethz.ch/~slist/pantomime/rrdtool-AVGNONAN.diff

Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the rrd-developers mailing list