1

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
Geekman
  • 451
  • 1
  • 11
  • 21
  • Will above method (`CDEF:rx=rx1,rx2,+,rx3,+`) work if RRD files are added the data at different timestaps (in your example `cust1/eth0.rrd` has times a bit earlier than `cust2/eth0.rrd` and so on)? – dma_k Aug 20 '18 at 12:13

2 Answers2

1

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

Basically, in my CDEF statements, rx1 would become rx1,UN,0,rx1,IF. And rx2 becomes rx2,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,+

Geekman
  • 451
  • 1
  • 11
  • 21
  • You may wan't to be using the ADDNAN operator ... OTOH, treating NAN as 0 might return rather missleading results ... since some number you do not know plus some other number is still a number you do not know. – Tobi Oetiker Feb 12 '14 at 22:53
-2

Try The following:
CDEF:rx=rx1,rx2,rx3,+,+

It worked for me.

Reaces
  • 5,597
  • 4
  • 38
  • 46
Megamind
  • 1
  • 1
  • While this may be correct, it would be a lot more helpful if you could explain why this change should be made. – Jenny D Sep 08 '15 at 10:47