Search code examples
graphrrdtoolrrd

rrdtool: Get the maximum value of the y axis / maximum of all curves


Is there an easy way to get the maximum value of all curves in an rrd chart (which is the computed height of the y axis)?

I have a chart with multiple temperature curves. I also have the state of some pumps, represented as 0 or 1. I now want to display a line if the respective pump is on and none if it's off.

I thought about simply putting the line above all over lines, by multiplying the DS with the maximum of all temperature curves plus some space.

I found that I can do

VDEF:some_maximum=some_ds,MAXIMUM

to get the maximum value of one DS. But how can I get the maximum of those values? Or is there an easier way to get the overall maximum y value?

Thanks in advance for all help!


Solution

  • If you first do

    CDEF:maxds=ds1,ds2,MAXNAN,ds3,MAXNAN
    

    and then

    VDEF:maxval=maxds,MAXIMUM
    

    you get the overall max.

    I used MAXNAN and not MAX to still give you a number even in the presence of Unknown (NAN) data.