[rrd-users] Dynamic Background

Simon Hobson linux at thehobsons.co.uk
Fri Dec 16 19:47:16 CET 2011


Jan Mara wrote:

>just a quick question is there any way to implement a dynamic background
>color based on lets say MAX or MIN Datasource values?

You mean something like, if max load is >70% then shade the 
background pale red, if it's over 90% then shade the background 
bright red ?

This can be "fudged", but only for the data area of the graph, by 
drawing an area in the colour you want before drawing the real data. 
If you want it to vary across the X axis depending on the data, then 
you can do something along the lines of :

if <val> > <some value>
   then x=<max value>
   else x=unknown
and then plot x as an area. I think it would be something like this :

DEF:val= ....

CDEF:background=val,${limit},GT,${max},UNKN,IF

AREA:background ...
LINE:val ...

Where limit and max are values computed separately prior to calling 
rrd tool to draw the graph.


Also, there are options to change the colour of the graph elements, 
see "-c|--color" in http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html


-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.



More information about the rrd-users mailing list