I am using rrd graph
to manually generate a graph of aggregated data, based on RRDs that were collected via PNP4Nagios. My issue is that when I try and aggregate more than two sources, I get a blank graph.
I believe I have the correct CDEF format, to generate aggregated data sources, based on the following: http://oss.oetiker.ch/rrdtool/tut/cdeftutorial.en.html (See "Converting your wishes to RPN").
Based on that article, I use:
CDEF:rx=rx1,rx2,+,rx3,+,rx4,+,...,rx10,+,rx11,+
Which only works if I aggregate the first two data sources in the statement, any time I do 3 or more, I get a blank graph.
I can't figure out why this is? The only difference between a working graph and a non-working on is the CDEF statement.
Works: CDEF:rx=rx1,rx2,+
Doesn't work: CDEF:rx=rx1,rx2,+,rx3,+
Here is the full working RRD graph statement with only 2 of the sources aggregated:
rrdtool graph bw_graph.png -a PNG --start=1389348873 --end=1392096786 --step 30 -w 597 -h 188 -v "Interface Traffic (bps)" \
'DEF:rx1=/path/to/data/cust1/eth0.rrd:1:AVERAGE' \
'DEF:tx1=/path/to/data/cust1/eth0.rrd:2:AVERAGE' \
'DEF:rx2=/path/to/data/cust2/eth0.rrd:1:AVERAGE' \
'DEF:tx2=/path/to/data/cust2/eth0.rrd:2:AVERAGE' \
'DEF:rx3=/path/to/data/cust3/eth0.rrd:1:AVERAGE' \
'DEF:tx3=/path/to/data/cust3/eth0.rrd:2:AVERAGE' \
'DEF:rx4=/path/to/data/cust4/eth0.rrd:1:AVERAGE' \
'DEF:tx4=/path/to/data/cust4/eth0.rrd:2:AVERAGE' \
'CDEF:rx=rx1,rx2,+' \
'CDEF:tx=tx1,tx2,+' \
'AREA:rx#0F5BFF:RX' \
'AREA:tx#FF9933:TX' \
GPRINT:rx:MAX:"RX Max %6.2lf %s" \
GPRINT:rx:MIN:"RX Min %6.2lf %s" \
GPRINT:rx:AVERAGE:"RX Avg %6.2lf %s" \
GPRINT:rx:LAST:"RX Curr %6.2lf %s\n" \
-t bw_graph
I've found that the issue in this case was not that I was adding more than two data sources - that was fine. The issue was that one of the data sources I was adding just happened to have undefined data, and that in turn was causing the entire graph to be nulled.
I found this by experimentation - I tried adding
rx3,rx4,+
and found the graph was still broken, with only those two pairs. It seemed rx3 was the cause of my issues.Going a step further to confirm my issue, I decided to aggregate 4,5,6:
rx4,rx5,+,rx6,+
worked fine, and generated a graph.After some searching, I found an article which mentioned this issue: http://rrd-mailinglists.937164.n2.nabble.com/adding-DS-values-from-multiple-rrd-files-tp5368188p5512061.html
Then, with some addition help from this document, on how to use
UN
to substitute unknown data with 0: http://oss.oetiker.ch/rrdtool/tut/cdeftutorial.en.htmlBasically, in my CDEF statements,
rx1
would becomerx1,UN,0,rx1,IF
. Andrx2
becomesrx2,UN,0,rx2,IF
etc...A final CDEF might look something like:
CDEF:rx=rx1,UN,0,rx1,IF,rx2,UN,0,rx2,IF,+,rx3,UN,0,rx3,IF,+
Try The following:
CDEF:rx=rx1,rx2,rx3,+,+
It worked for me.