[rrd-users] Line Colour Based on Value

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Sat Mar 2 13:00:15 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.
> I am assuming I need to call rrdtool twice and fetch the MAX value and
> then use that in my script to determine the colour?
> Is this a way to achieve this without a double pass?

Sure, with VDEF and a couple of CDEFS.

Basically this:

if {some statement = true} then values of line1 are orig_values else they 
are unknown
if {some statement = false} then values of line2 are unknown else they are 

now draw line1 in red and line2 in green, do not draw orig_values anymore.
{some statement} is an IF-THEN-ELSE using a VDEF

More information about the rrd-users mailing list