[rrd-users] Area in different colors
Alex van den Bogaerdt
alex at ergens.op.het.net
Tue Dec 4 15:36:11 CET 2007
On Tue, Dec 04, 2007 at 02:48:55PM +0100, Simone Felici wrote:
> Hi to all!
>
> I know, this was often discussed, but I cannot find an example.
> I've a graph with one DS (area) and I need this single DS change color every 20 units if the DS goes over these values. The scale goes from 0 to 100
> (like a rainbow).
> I've found something but only changing one time the colour:
>
> (...)
> 'DEF:cnxs=NbCnx.rrd:cnxs:AVERAGE' \
> 'CDEF:Cnxs=cnxs,600,LE,cnxs,600,IF' \
> 'CDEF:CnxsOrange=cnxs,600,LE,0,cnxs,600,-,IF' \
> 'AREA:Cnxs#00FF00' \
> 'STACK:CnxsOrange#FF9F00'
> (...)
>
> This works, but I've no idea how to create multiple colors...
> Can someone help me?
> Thank's a lot!
Create 5 CDEFs, each acting on its own range. For instance:
20 and less: CDEF:C1=value,20,LE,value,UNKN,IF
20-40: CDEF:C2=value,20,40,LIMIT
40-60: CDEF:C3=value,40,60,LIMIT
60-80: CDEF:C4=value,60,80,LIMIT
80 and more: CDEF:C5=value,80,GE,value,UNKN,IF
Each CDEF is unknown if it is outside the specified range.
Now plot them:
AREA:C5#FF0000:color5
AREA:C4#0FF000:color4
AREA:C3#00FF00:color3
AREA:C2#000FF0:color2
AREA:C1#0000FF:color1
You can make it more complex, using a lot of if-then-else, you can
stack area's upon the previous one, etc. But these are the basics.
HTH
--
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/
More information about the rrd-users
mailing list