I have done a quick search for this on the forums but nothing immediately showed up. Here's my question/problem.
I have a collection of RRD files, say, 0-9 (file0.rrd, file1.rrd .... file9.rrd) all with the same data source names in them, and what I require is to graph the sum of each data source across all RRD files.
For example, let's say there is a data source called "count" in each file. I need to calculate file0.rrd:count+file1.rrd:count+file2.rrd:count ... file9.rrd:count, and then graph this value.
So far, I have managed to bring each of these data sources into a graph template, and then use the notation that cacti uses to sum using CDEFs. For example, to get the summation of the above, I could just use this very simple CDEF in a graph template and then graph it.
Code: Select all
a,b,c,d,e,f,g,h,i,j,+,+,+,+,+,+,+,+,+
If this is the case, I then need some CDEF that converts NaNs to 0s before summing. Maybe something like this:
Code: Select all
a,NaN,EQ,0,a,IF,b,NaN,EQ,0,b,IF,c,NaN,EQ,0,c,IF,d,NaN,EQ,0,d,IF,e,NaN,EQ,0,e,IF,f,NaN,EQ,0,f,IF,g,NaN,EQ,0,g,IF,h,NaN,EQ,0,h,IF,i,NaN,EQ,0,i,IF,j,NaN,EQ,0,j,IF,+,+,+,+,+,+,+,+,+
Can anybody advise on a better method of dealing with this problem? Or give me any pointers as to a better way of approaching it? Is there a more "correct" way of testing if a value is a NaN rather than the IF approach above?
Thanks.