[rrd-users] Strange behavior when using CDEF to divide two values

Simon Hobson linux at thehobsons.co.uk
Mon Feb 18 10:56:44 CET 2013


Wesley PA4WDH wrote:
>Ah, i see, i did not think about that but it sounds logical. So i guess my first take at troubleshooting should be to make the width of the graph >= the number of samples to rule out the effect of consolidation.
You set the width of the graph in pixel exactly equal to the number of samples. In addition, set the start and end times to an integral multiple of the consolidated period. If number of pixel is more than number of samples, then processing is required.
I've never investigated, so I don't know whether RRD simply repeats pixel as required (would give the results you want), or further mangles the data (wouldn't give the results you want).
Eg, suppose you had 200 samples and plotted a graph 300 pixels wide. One method would duplicate every other pixel, one would resample the data :
pixel 1 = sample 1
pixel 2 = (sample 1 + sample 2)/2
pixel 3 = sample 2
and so on

So, say your consolidated data has a resolution of 10 minutes (600s), set the end time to an integer multiple of 600 (all dates/times are stored/measured as seconds since unix epoch (midnight, 1st Jan 1970)). Then work back for your start time. In Bash :

Step=600
Pixels=500
Now=$( date +%s )
End=$(( ${Now} / ${Step} * ${Step} ))
Start=$(( ${End} - ${Step} * ${Pixels} ))

rrdtool ... --start=${Start} --end=${End} --width=${Pixels} ...

>Which consolidation fuction is used for this operation ? If it the one i defined at the RRA ?

It should be the same one as you select in your DEF statement.



More information about the rrd-users mailing list