[rrd-users] RRDs with unpredictable update time

Simon Hobson linux at thehobsons.co.uk
Wed Mar 25 00:00:48 CET 2009

Till Dörges wrote:

>I'm trying to collect and store data (e.g. how many times a TCP port is being
>accessed in a certain interval) but with a 
>rather unpredictable source. Ideally I get
>a measurement every 300 seconds. But sometimes I 
>don't get anything for hours or
>days. I intend to store the data for 7 days in the original resolution (300s).
>For performance reasons, 'rrdtool update' should 
>only be called, when there actually
>is data. This means for the example below, it's called only 5 times.


>If I do an update (with a value of 0) every 300 
>seconds, all values are in the RRA as
>I would expect it, but like I said, if possible 
>I'd like to avoid updates if there is
>no data.
>The question now is, whether there's a solution 
>for my problem or whether RRDtool
>simply is not designed to do so.

Well you are doing something the tool isn't really designed to do.

One thing you can do is to change a setting in 
the rrd file. As it is, after a fairly short 
interval (600s or 10m with your current setting) 
without an update, rrdtool does what it's 
supposed to and sets the data to unknown. 
However, if you do that, then you still won't get 
the results you want.

For example, when you do the update with value 
1111 at 2h10m, rrdtool will store 1111/((2h10m - 
10m) *60) for the entire period from 10m to 
2h10m. I assume what you want is 0 from 10m to 
2h5m, and 1111/300 from 2h5m to 2h10m. You could 
fix that by doing an update with 0 at 2h5m before 
doing the update with 1111 at 2h10m - but that's 
getting complicated.

That last bit would be another way to deal with 
it. Whenever you've not been filling data, you 
need to do an update with 0 at the previous step 
time. In this case, you would need to update with 
0 at 2h5m and then 111 at 2h10m. You would then 
find Nan from 20m to 2h5m, and 1111/300 from 2h5m 
to 2h10m.

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