[rrd-users] Line Colour Based on Value

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Sun Mar 3 00:38:11 CET 2013


----- Original Message ----- 
From: "Steve Shipway" <s.shipway at auckland.ac.nz>
To: "Chris Mason" <chris at netnix.org>; <rrd-users at lists.oetiker.ch>
Sent: Sunday, March 03, 2013 12:16 AM
Subject: Re: [rrd-users] Line Colour Based on Value


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

This is not what the OP asked for.  This shows a partial red line when above 
1000 and green for anything upto and including 1000.

The op asked for a red line when max(ds1) is above a certain value, not when 
ds1 is above that value. Using the same example number of 1000:

VDEF:ds1max=ds1,MAXIMUM
CDEF:ds1red=ds1max,1000,GT,ds1,UNKN,IF
CDEF:ds1green=ds1max,1000,GT,UNKN,ds1,IF

This produces a red line when the maximum value seen is above 1000, even 
when the current rate at that time interval is below 1000.

For others, looking for a similar but somewhat different feature:
You could have a line in red when the rate is more than 80% of the maximum 
and green otherwise:

VDEF:ds1max=ds1,MAXIMUM
CDEF:ds1red=ds1,ds1max,0.8,*,GT,ds1,UNKN,IF
CDEF:ds1green=ds1,ds1max,0.8,*,GT,UNKN,ds1,IF

And ofcourse similar techniques can be used to color the background instead 
of the line itself. I think it is in the tutorial, combine with this VDEF 
and enjoy.

HTH
Alex



More information about the rrd-users mailing list