[rrd-users] Problems with Last, Min and Max in rrd graph

Johan Elmerfjord jelmerfj at adobe.com
Wed Sep 11 11:56:16 CEST 2013


Hi Lutz,

This is probably a result of consolidation (and Averaging) that occurs
when several samples is combined when RRD-tool creates the graph.
It does this when it finds out that you have more values available -
than what you have pixels in the graph.

You can see the result of the averaged/consolidated Max and Min values
compared to the Max of Max and Min of Min-values in the following graph.
http://stats.villaelmerfjord.se/test_minmax-am18_week19_hourly.png

We have 5 years of 5 minute resolution - so no consolidation occurs in
the data-files.
Even if you have a Average RRD, you can get (and keep) the max and
min-values if you override the default consolidation method.
The above graph was created with the following arguments.

rrdtool graph test_minmax-am18_week19_full.png --imgformat PNG -s 1367791200 -e 1368396000 --height=700 --width 1600 \
    DEF:ds0=/home/httpd2/htdocs/admin/power/am18-temp_fahrenheit.rrd:ds0:AVERAGE \
    DEF:ds0max=/home/httpd2/htdocs/admin/power/am18-temp_fahrenheit.rrd:ds0:AVERAGE:reduce=MAX \
    DEF:ds0min=/home/httpd2/htdocs/admin/power/am18-temp_fahrenheit.rrd:ds0:AVERAGE:reduce=MIN \
    VDEF:ds0avg=ds0,AVERAGE \
    VDEF:ds0avgmax=ds0,MAXIMUM \
    VDEF:ds0avgmin=ds0,MINIMUM \
    VDEF:ds0maxmax=ds0max,MAXIMUM \
    VDEF:ds0minmin=ds0min,MINIMUM \
    VDEF:ds0pct=ds0,95,PERCENT \
    LINE1:ds0#0000FF:"Temperature" \
    LINE1:ds0max#FF0000:"Temp Max" \
    LINE1:ds0min#00FF00:"Temp Min" \
    LINE1:ds0avgmax#FF0050:"Temp Avg Max" \
    LINE1:ds0avgmin#00FFA0:"Temp Avg Min" \
    LINE1:ds0maxmax#FF50A0:"Temp Max of Max" \
    LINE1:ds0minmin#50FFA0:"Temp Min of Min" \
    LINE1:ds0pct#101010:"95 Percentile\l" \
    COMMENT:" \l" \
    COMMENT:"Average     " \
    COMMENT:"MaxAverage  " \
    COMMENT:"MinAverage  " \
    COMMENT:"MaxOfMax    " \
    COMMENT:"MinOfMin    " \
    COMMENT:"95th percentile\l" \
    GPRINT:ds0avg:"%6.2lf %SdegF" \
    GPRINT:ds0avgmax:"%6.2lf %SdegF" \
    GPRINT:ds0avgmin:"%6.2lf %SdegF" \
    GPRINT:ds0maxmax:"%6.2lf %SdegF" \
    GPRINT:ds0minmin:"%6.2lf %SdegF" \
    GPRINT:ds0pct:"%6.2lf %SdegF\l"


The important thing here is the additional DEFS I create where I specify
the reduce functions. (to override the default AVERAGE that is specified
in our RRDs).
The last part is just for printing the different values under the graph.

/Johan

-- 
  
Johan Elmerfjord | Sr. Systems Administration/Mgr, EMEA | Adobe Systems,
Product Technical Operations | p. +45 3231 6008 | x86008 | cell. +46 735
101 444 | Jelmerfj at adobe.com 

On Wed, 2013-09-11 at 02:07 -0700, Lutz Schulze wrote:
> Hello,
>  
> we use RRDTools with an own PHP script and generate graphs at this
> way:
>  
> $options = "";
> $options .= " $img_file";
> $options .= " -t \"$vdesc\t$desc2\" ";
> $options .= " --start $start";
> $options .= " --end $end";
> $options .= " -w $width";
> $options .= " -h $height";
> $options .= " --slope-mode";
> $options .= " -c SHADEA#f0f0f0 ";
> $options .= " -c SHADEB#f0f0f0 ";
> $options .= " -W ".$config['watermark'];
> $options .= " -c ARROW#58A6A7 ";
> $options .= " DEF:$val=$rrd_file:$sid:AVERAGE";
> $options .= " LINE2:$val$color[$i]:\"$beschreibung\" ";
> $options .= " GPRINT:$val:LAST:\"%4.1lf\"";
> $options .= " GPRINT:$val:MIN:\"min %4.1lf%s\"";
> $options .= " GPRINT:$val:MAX:\"max %4.1lf%s\l\"";
> 
> popen(RRDTOOL." graph $options", "r");
>  
> When we now generate graphs with different sizes unfortunately the
> values for LAST, MIN and MAX change also:
>  
> small picture:
> http://km2.klima-monitor.de/system.graph.php?mode=view&vid=3&t=y&se=2&start=01.01.2013&end=01.01.2014&width=429&height=200
> 
> big picture:
> http://km2.klima-monitor.de/system.graph.php?mode=view&vid=3&t=y&se=2&start=01.01.2013&end=01.01.2014&width=837&height=400
>  
>  
> I think it is a problem with sampling the used values from the
> archive. Is there a way to make this better?
>  
> Thank you for all help
>  
> Lutz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20130911/486e06c7/attachment.htm 


More information about the rrd-users mailing list