From f2b2b4e993fcefcb7b811d0acaf8c88e26873b30 Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Wed, 18 Jun 2014 17:06:55 +0200 Subject: [PATCH] Trend should not go below 0 --- graph | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/graph b/graph index a163bfd..74c8150 100755 --- a/graph +++ b/graph @@ -474,24 +474,25 @@ else (( end > 0 )) && end="+$end" (( datastart > 0 )) && datastart="+$datastart" - rrdtool graph - \ - -a PNG \ - -w $graph_width \ - -v $graph \ - -s $start -e $end \ + rrdtool graph - \ + -a PNG \ + -w $graph_width \ + -v $graph \ + -s $start -e $end \ DEF:data=$rrdfile:$graph:AVERAGE:step=3600${datastart+:start=$datastart}${dataend+:end=$dataend} \ - DEF:fail=$rrdfile:$graph:FAILURES \ - VDEF:last=data,LAST \ - VDEF:intercept=data,LSLINT \ - VDEF:growth=data,LSLSLOPE \ - CDEF:trend=data,POP,COUNT,growth,*,intercept,+ \ - CDEF:pred=TIME,NOW,GE,trend,UNKN,IF \ - LINE1:trend#FFFF00:Trend\\t \ - "${draw[@]:-AREA:data#00BD27}" \ - "${thresholds[@]}" \ - TICK:fail#ffffa0:1.0 \ - VRULE:$now#000000 \ - 'GPRINT:data:MIN:min %6.2lf%S' \ - 'GPRINT:data:MAX:\tmax %6.2lf%S' \ + DEF:fail=$rrdfile:$graph:FAILURES \ + VDEF:last=data,LAST \ + VDEF:intercept=data,LSLINT \ + VDEF:growth=data,LSLSLOPE \ + CDEF:trend=data,POP,COUNT,growth,*,intercept,+ \ + CDEF:trendline=trend,0,GT,trend,UNKN,IF \ + CDEF:pred=TIME,NOW,GE,trend,UNKN,IF \ + LINE1:trendline#FFFF00:Trend\\t \ + "${draw[@]:-AREA:data#00BD27}" \ + "${thresholds[@]}" \ + TICK:fail#ffffa0:1.0 \ + VRULE:$now#000000 \ + 'GPRINT:data:MIN:min %6.2lf%S' \ + 'GPRINT:data:MAX:\tmax %6.2lf%S' \ "${next[@]}" fi