[rrd-users] Can't store data to RRD file

Simon Hobson linux at thehobsons.co.uk
Tue Jan 17 16:25:27 CET 2012

Adriano Monteiro Marques wrote:

>I've being trying for a couple of days to create an RRD and store 
>some data in it. I read the documentation, and followed examples, 
>but couldn't manage to get it working. It could be either a bug or a 
>non-obvious error in my code. Here is how to reproduce:
>$ rrdtool create filename.rrd \
>  > --step '1' \
>  > 'DS:reads:GAUGE:10:0:U' \
>  > 'DS:writes:GAUGE:10:0:U' \
>  > 'RRA:AVERAGE:0.5:300:100' \
>  > 'RRA:AVERAGE:0.5:300:1000' \
>  > 'RRA:AVERAGE:0.5:300:500'
>$ rrdtool update filename.rrd N:1:1
>$ rrdtool update filename.rrd N:1:2
>$ rrdtool update filename.rrd N:3:2
>$ rrdtool update filename.rrd N:3:5
>$ rrdtool update filename.rrd N:6:5
>$ rrdtool update filename.rrd N:6:8
>$ rrdtool update filename.rrd N:6:9
>$ rrdtool update filename.rrd N:6:10
>$ rrdtool update filename.rrd N:6:11
>$ rrdtool update filename.rrd N:6:12
>$ rrdtool fetch filename.rrd AVERAGE
>                           reads              writes
>1326722400: nan nan
>1326722700: nan nan
>1326723000: nan nan
>1326723300: nan nan
>It continues like this showing only nan for dozens of lines and I 
>don't get any useful content out of it. What am I missing?

Have you really read the docs ?

You've defined an RRD with a step of 1 - that means 1 second per PDP. 
You've set the heartbeat to 10 in your DSs, so if more than 10 
seconds between updates the value becomes unknown. Given the 
timescales in the output, it looks like you are updating at somewhat 
more than 10 second gaps, therefore your data is always unknown.

Next, you've defined three RAAs, all with consolidation function of 
AVERAGE, all with 300 steps/row. Thus the RRA with 100 rows contains 
exactly the same data as the first 100 rows of the other two RRAs, 
and the RRA with 500 rows contains exactly the same data as the RRA 
with 1000 rows.

And of course, what you show us is **NOT** enough to reproduce the 
problem. You give no idea at all of timing - "N" tells us nothing 
about when the updates were run. If you are going to post examples, 
you need to include that data (ie use actual times rather than "N").

Try Alex's tutorials at http://www.vandenbogaerdt.nl/rrdtool/
especially "Rates, normalizing and consolidating"
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