[rrd-users] Temperature diff colors

2015-09-09 Thread Martin

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-users@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users


Re: [rrd-users] Temperature diff colors

2015-09-09 Thread Johan Elmerfjord
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 '' \
--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#FF:"0%": \
AREA:PL10#00:"0-10%": \
AREA:PL25#CCEE00:"10-25%": \
AREA:PL50#BBB000:"25-50%": \
AREA:PL75#FFD000:"50-75%": \
AREA:PL100#FF:"75-100%": \
COMMENT:"\n" \
LINE1:rtt_min#3030ff \
AREA:rtt_diff#a0a0ff::STACK \
LINE1:rtt_max#3030ff \
LINE1:rtt_min#3030ff \
LINE2:rtt#ff:${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-users@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

___
rrd-users mailing list
rrd-users@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users


Re: [rrd-users] Temperature diff colors

2015-09-09 Thread Simon Hobson
Martin  wrote:

> 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 ?

Here's one I did that does "light red" when things are close to the limit, and 
"full on red" when above the limit (it's part of a Bash script) :

>   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
> AREA:alarm1#FFBFBF:
> CDEF:alarm2=op_pc_max,99,1,LIMIT
> AREA:alarm2#FF:
> 
> COMMENT:\"  min  ave  max  last\n\"
> HRULE:${Plimit}#7F
> AREA:op_pc_min#FF00:
> AREA:op_pc_spread#BFBFFF::STACK
> LINE1:op_pc_ave#FF:\"%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.

___
rrd-users mailing list
rrd-users@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users