Discussion:
[rrd-users] Temperature diff colors
(too old to reply)
Martin
2015-09-09 14:34:18 UTC
Permalink
Hello all,

I´m wondering if anyone has a code example for showing diffrent colors
in a graph depending on temperatue like this, if it above +0 and up the
color is red and if its below -0 its blue ?

cheers //M
Johan Elmerfjord
2015-09-09 15:36:28 UTC
Permalink
Hi Martin,

I think you can get some ideas of the following.

I can't test it - so I just took some code that I had in a completely different graph.
But I think the idea is to create different CDEF's according to the temperature intervals.
Then set the color according to this.

Good luck!
/Johan




rrdtool graph ping_${host}_hour.png -h 300 -w 700 -a PNG \
--imginfo '<IMG SRC=/%s WIDTH=%lu HEIGHT=%lu >' \
--start -28800 --end -60 \
-v "Round-Trip Time (ms)" \
--rigid \
--lower-limit 0 \
--title "Ping statistics: $host" \
DEF:rtt=${host}_rtt.rrd:ds0:AVERAGE \
DEF:rtt_min=${host}_rtt_min.rrd:ds0:MIN \
DEF:rtt_max=${host}_rtt_max.rrd:ds0:MAX \
DEF:ploss=${host}_packet_loss.rrd:ds0:AVERAGE \
CDEF:rtt_diff=rtt_max,rtt_min,- \
CDEF:PLNone=ploss,0,0,LIMIT,UN,UNKN,INF,IF \
CDEF:PL10=ploss,1,10,LIMIT,UN,UNKN,INF,IF \
CDEF:PL25=ploss,10,25,LIMIT,UN,UNKN,INF,IF \
CDEF:PL50=ploss,25,50,LIMIT,UN,UNKN,INF,IF \
CDEF:PL75=ploss,50,75,LIMIT,UN,UNKN,INF,IF \
CDEF:PL100=ploss,75,100,LIMIT,UN,UNKN,INF,IF \
COMMENT:"(Packet Loss Percentage)" \
AREA:PLNone#FFFFFF:"0%": \
AREA:PL10#FFFF00:"0-10%": \
AREA:PL25#CCEE00:"10-25%": \
AREA:PL50#BBB000:"25-50%": \
AREA:PL75#FFD000:"50-75%": \
AREA:PL100#FF0000:"75-100%": \
COMMENT:"\n" \
LINE1:rtt_min#3030ff \
AREA:rtt_diff#a0a0ff::STACK \
LINE1:rtt_max#3030ff \
LINE1:rtt_min#3030ff \
LINE2:rtt#0000ff:${host} \
GPRINT:rtt:LAST:"Cur\: %5.2lf" \
GPRINT:rtt:AVERAGE:"Avg\: %5.2lf" \
GPRINT:rtt:MAX:"Max\: %5.2lf" \
GPRINT:rtt:MIN:"Min\: %5.2lf\n"





On Wed, 2015-09-09 at 16:34 +0200, Martin wrote:


Hello all,

IÂŽm wondering if anyone has a code example for showing diffrent colors
in a graph depending on temperatue like this, if it above +0 and up the
color is red and if its below -0 its blue ?

cheers //M

_______________________________________________
rrd-users mailing list
rrd-***@lists.oetiker.ch<mailto:rrd-***@lists.oetiker.ch>
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
Simon Hobson
2015-09-09 16:37:23 UTC
Permalink
I´m wondering if anyone has a code example for showing diffrent colors in a graph depending on temperatue like this, if it above +0 and up the color is red and if its below -0 its blue ?
echo "${RRDHead}
DEF:op_pc_ave=${RRDPath}/${RRDName}:op_pc:AVERAGE
DEF:op_pc_min=${RRDPath}/${RRDName}:op_pc:MIN
DEF:op_pc_max=${RRDPath}/${RRDName}:op_pc:MAX
CDEF:op_pc_spread=op_pc_max,op_pc_min,-
VDEF:v_op_pc_ave=op_pc_ave,AVERAGE
VDEF:v_op_pc_max=op_pc_max,MAXIMUM
VDEF:v_op_pc_min=op_pc_min,MINIMUM
VDEF:v_op_pc_lst=op_pc_ave,LAST
CDEF:alarm1=op_pc_max,${Plimit},100,LIMIT
CDEF:alarm2=op_pc_max,99,10000,LIMIT
COMMENT:\" min ave max last\n\"
HRULE:${Plimit}#7F0000
AREA:op_pc_spread#BFBFFF::STACK
LINE1:op_pc_ave#0000FF:\"%age Power\"
GPRINT:v_op_pc_min:\"%6.0lf \"
GPRINT:v_op_pc_ave:\"%6.0lf \"
GPRINT:v_op_pc_max:\"%6.0lf \"
GPRINT:v_op_pc_lst:\"%6.0lf\"
COMMENT:\" Data to ${PrintedTime}\n\"
For yours' what I'd suggest is two CDEFs, one which is X when X < 0 and UNKN when X >= 0, the other which is X when X is >= 0 and UNKN when X < 0. Then plot the first CDEF in blue, and the second one in red.

So something like :
CDEF:xb=x,unkn,x,0,lt,if
CDEF:xr=x,unkn,x,0,ge,if
should (if I've got my RPN right from memory) give you the two series to draw.
Loading...