[rrd-users] RPN Question

Sven Ulland sveniu at opera.com
Tue Apr 17 14:19:03 CEST 2007


Wesley PA4WDH wrote:
> Hi All,
> 
> I have a question about RPN. I'm sorry if it has been
> asked before. I've search my email archive but didn't
> find it.
> 
> I have a lot of rrd's with the same DS in it. What i
> want to do is to calculate the sum of all the DS's and
> display that in a "total" graph.
> 
> The problem is that those DS's have a lot of unknown
> values in it. What i need is a RPN that does:
> 
> if (value_of_ds != unknown)
> return new_value+total_caluclated_so_far
> else return total_calculated_so_far

Yes. That is explained in the tutorial found here:
http://oss.oetiker.ch/rrdtool/tut/cdeftutorial.en.html

> I have tried this:
> total=new_value,UN,total_calucated_so_far,total_calulated_so_far,new_value,+,IF

DEF:ds_one=rrdfile.rrd:foo:AVERAGE
DEF:ds_two=rrdfile.rrd:bar:AVERAGE
DEF:ds_three=other_rrdfile.rrd:baz:AVERAGE

CDEF:total=\
ds_one,UN,0,ds_one,IF,\
ds_two,UN,0,ds_two,IF,+,\
ds_three,UN,0,ds_three,IF,+

Something like that would do the trick. A line can be
read like so:

"If ds_one == UNKNOWN, then return 0; else return ds_one"

> [...]

S



More information about the rrd-users mailing list