[rrd-users] coloring graphs red when the input his a border

Serge Maandag serge.maandag at staff.zeelandnet.nl
Fri Apr 20 15:04:53 MEST 2001


question:

When graphing my data I want to define a threshold. If the value
crosses that threshold, I want it to turn red.

Say I wanted to graph data that has a threshold of 10. I would like the
line to be green if it's under 0 and red if it's over 10. I defined
this:

rrdtool graph FileName.png
	--start -1h 
	--end $now  
	DEF:perc=rrdfile.rrd:$ds:AVERAGE
	CDEF:danger=perc,10,GT,perc,10,IF
	CDEF:good=perc,10,GT,10,perc,IF  
	HRULE:10#0000FF:"Maximum allowed"
	LINE2:good#00FF00:"Safe bw"
	LINE2:danger#ff0000:"high bw"

Which basically says:

danger:
if perc > 10
	danger = perc
else
	danger = 10
end if

good:
if perc > 10
	danger = 10
else
	danger = perc
end if

the output is ugly though. It gives nasty alternating horizontal and
green lines at the threshold level (10).

So then I came up with this one:

rrdtool graph FileName.png
	--start -1h 
	--end $now  
	DEF:perc=rrdfile.rrd:$ds:AVERAGE
	CDEF:danger=perc,10,GT,perc,UNKN,IF
	CDEF:good=perc,10,GT,UNKN,perc,IF  
	HRULE:10#0000FF:"Maximum allowed" 
	LINE2:good#00FF00:"Safe bw" 
	LINE2:danger#ff0000:"high bw" 
 
Which turns the green line invisible for values over 10 and the red one
invisible for lines under 10.
The trouble here is that the lines don't connect. Everytime the line
crosses the threshold there is a missing part, the red and green parts
don't connect.

Can anybody give me a hint how to do this better?

TIA,

Serge Maandag 

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list