[rrd-users] Line Colour Based on Value

Steve Shipway s.shipway at auckland.ac.nz
Sun Mar 3 00:16:01 CET 2013


>I want to change the colour of the line depending on the MAX value -
>if it is over a certain value I want a red line, but if it is below I
>want a green line.

You do it by creating two lines, one for the red part and one for the green part.

DEF:ds1=<rrdfile>:ds1:MAX
CDEF:ds1red=ds1,1000,GT,ds1,UNKN,IF
CDEF:ds1green=ds1,1000,GT,UNKN,ds1,IF
LINE1:ds1green#00CC00:DS1\\l
LINE1:ds1red#CC0000

Now, your green line appears to turn red when the value is over 1000.

It would be good if the line colour could be specified as a CDEF rather than just as a constant; maybe this feature can be on the wishlist for RRDtool 2.x ...

Steve

Steve Shipway
University of Auckland ITS
UNIX Systems Design Lead
s.shipway at auckland.ac.nz
Ph: +64 9 373 7599 ext 86487




More information about the rrd-users mailing list