[rrd-users] Basic information about "rrdtool create" command

Simon Hobson linux at thehobsons.co.uk
Sat Oct 13 09:53:51 CEST 2012

gerixxx wrote:

>rrdtool create myrouter.rrd         \
>             DS:input:COUNTER:600:U:U   \
>             DS:output:COUNTER:600:U:U  \
>             RRA:AVERAGE:0.5:1:600      \
>             RRA:AVERAGE:0.5:6:700      \
>             RRA:AVERAGE:0.5:24:775     \
>             RRA:AVERAGE:0.5:288:797    \
>             RRA:MAX:0.5:1:600          \
>             RRA:MAX:0.5:6:700          \
>             RRA:MAX:0.5:24:775         \
>             RRA:MAX:0.5:288:797
>Why are there a lot of consolidation functions? I know, what they mean
>(including parameters), but I don't know, why is there 4x AVERAGE or MAX in
>that sequence.

Err, that's an oxymoron - if you know what the 4 sets of number mean 
then you know why they are there.
RRD does not keep any data automatically - you have to tell it what 
you want to keep. So you (or whoever wrote the command you cribbed 
from somewhere) obviously wants to keep 600 samples at 5 minute 
intervals (using default step size of 300s), plus 700 consolidated 
points at 1/2 hour intervals (685 minutes), and so on. And you want 
these for both average and maximum consolidations.

You don't *have* to have consilidations (beyond the first one of 
course), you could just as easily keep 230k samples at 5 minute 
intervals - but that would require a lot of disk space, and take a 
long time to process for a lot of graphs. Hence the ability to throw 
away resolution after a while, and keep less detail for a longer time.

>Of course, at the end, I want to create a graph, and when I have to define
>parameters, there is a reference to *.rrd file:
>rrdtool graph myrouter-day.gif --start -86400 \
>             DEF:inoctets=myrouter.rrd:input:AVERAGE \
>             DEF:outoctets=myrouter.rrd:output:AVERAGE \
>             AREA:inoctets#00FF00:"In traffic" \
>             LINE1:outoctets#0000FF:"Out traffic"
>In the 2nd and 3rd rows are defined variables, containing stored data, but
>from these parameters I can't decide, which average data will be displayed
>from 4 definitions of average at create command. Is very important the
>sequence of definitions of RRAs? Why?

RRD will default to using the higher resolution data that will fill 
the graph. So of that graph, it will probably use the 5 minute data 
as that will fill the graph. Personally I munge the start and end 
time to make it less hit and miss. Pick the resolution you expect to 
be used, and make the start and end times an integer multiple of that.
Eg (in bash) :
res=1800 # 1/2 hour
steps=400 # 400 steps (=200 hours, 8.3 days), picked to match teh 
number of pixel we'll put in the graph

now=$( date +%s )
end=$(( $now / $res * $res ))
start=$(( $end - $res * $steps ))

Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.

More information about the rrd-users mailing list