[rrd-developers] Re: Fwd: Can CDEF be made to compute averages from 2 different data sources ?

Jeff S Wheeler jsw at five-elements.com
Fri Feb 27 15:07:27 MET 2004


On Fri, 2004-02-27 at 03:53, Eric Ho wrote:
> Is it possible to write a CDEF to compute the average of some of the
> samples from these 2 data sources and then graph this average value ?
> By 'some samples', I mean samples from a certain period of time
> in the past.

The short answer is yes, you can do this; but rrd-developers is not the
right place to be asking this question.  This belongs on -users.  Here
is a quick example of the DEFs, CDEF, and LINE you'll need.

DEF:tx_rate_port1=port1.rrd:tx_bits:AVERAGE
DEF:tx_rate_port2=port2.rrd:tx_bits:AVERAGE
CDEF:tx_rate=tx_rate_port1,tx_rate_port2,+
LINE1:tx_rate:tx

If you encounter circumstances when you have a new port added, which
would throw a wrench into your graph by supplying UNKNOWN values for the
period when the new port wasn't sampled, but is being requested by your
graph command, you'll need some more CDEF-fu:

CDEF:tx_rate=tx_rate_port1,UN,0,tx_rate_1,IF,tx_rate_port2,UN,0,tx_rate_2,IF,+

The above will convert UNKNOWN sample values in either port's sample
data to valid samples with a value of 0.  I use this when generating
aggregate graphs for customer traffic, since I often have customers with
multiple ports, and they tend to add/move/delete ports sometimes as
their needs change, but still need useful graphs during those times.

Once again, please post questions about rrdtool usage to the users list.
The developers list is meant for folks with questions about the source
(and I don't mean compiler problems, unless first explored on -users)
because they're writing/contributing code to rrdtool.</rant>

--
Jeff

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