[rrd-users] Line Colour Based on Value

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Mon Mar 4 00:21:38 CET 2013


>> 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.
>
> So, I am assuming this works because a line won't be drawn if the
> value is UNKN.

Yes

> However, wouldn't you still get 2 legends - a red one and a green one?

Not necessarily. You could opt to not display a legend when drawing a line 
(or area).

But now that you have altered the problem to solve, this doesn't help you.

> I have 32 routers and I am polling the total power usage to plot on a
> graph - this results in 32 lines on my graph which makes it hard to
> see each router on the graph. However, I am using the legend colour to
> alert the user for when the power usage is over 2100 w for a router.

Unless there is something new which I do not yet know about, there is no way 
to
script this inside RRDtool.

A two pass solution is probably best in this case, this would also allow for 
some flexibility in alerting the user. I'm thinking about sending an email, 
text message to the phone, activating a strobe warning light, you name it.

I don't think it's possible, but in your case I would like to set the 
background for each legend line where max>2100.

> I have uploaded my current graph as an example: 
> http://netnix.org/power-1d.png
>
> In the graph, when a MAX value is over 2100 then I want the line to
> turn red and show a red legend so it can easily been seen by the user.

No offense, but in my opinion this graph is not really usable. There are 
hardly any fluctuations, many lines overlap, all have the same color and 
although this would change, you would still end up with a cluster of green 
lines and a cluster of red lines, hardly an improvement I think.

If I may make a suggestion:

Use rrdtool if you want to store the values.  Retrieve them in your script 
probably using rrdtool graph with a series of VDEFs and PRINTs (not GPRINT) 
and use those maximum values to generate a clickable HTML page. After 
clicking on a router's entry, just present a graph for one router.

This way you have your status page to show problem areas, and you will 
present useful data to your user. 



More information about the rrd-users mailing list