rrdtool: Display 2 values with correct size on y-axis

545 views Asked by At

I want to display 2 values on the Y axis correctly with rrdtool. The first value has a range of 0-70, the second from 0-800.

The scale of values should be appropriate. With --right-axis=0.1:0 I can adjust the naming on the right side, but the value is not "resized'd", so that e.g. a value "10" practically disappears on the 0 line when the 2nd value is 500.

Can this be done correctly?

1

There are 1 answers

0
Steve Shipway On

The option you want is --right-axis 10:0 to display a second Y-axis that is scaled 10:1 with no offset. You then need to scale your second variable before you plot it so that it will be relative to the second axis.

Here is an example

rrdtool graph --right-axis 10:0 \
  --vertical-label "Variable A" \
  --right-axis-label "Variable B" \
  DEF:a=file.rrd:a:MAX \
  DEF:b=file.rrd:b:MAX \
  CDEF:bb=b,10,/ \
  LINE:a#ff0000:VariableA \
  LINE:bb#00ff00:VariableB

Of course, if you want to print values for 'b' in the legend, then calculate them based on 'b' rather than 'bb'.

See here for the documentation: https://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html