[rrd-users] RRDs with unpredictable update time

Karl Fischer rrd-users at ficos.de
Wed Mar 25 09:27:00 CET 2009


Till Dörges wrote:
> Hello everybody,
> 
> 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.

<snip>

Till,

well, as Simon and Darren said already, rrdtool is not really designed for that.
However, you can get around this by changing your heartbeat to a week and insert
just one zero at N-300 if there hasn't been an update at N-300, so you need to
remember the last update or to query the rrdb:

rrdtool create test.rrd --start=1237923600 DS:events:GAUGE:604800:0:U RRA:AVERAGE:0.5:1:2016

rrdtool update test.rrd 1237923900:123
rrdtool update test.rrd 1237924200:456
rrdtool update test.rrd 1237924500:789
rrdtool update test.rrd 1237931400:0 1237931700:1111  # last update >=300s ago
rrdtool update test.rrd 1237938600:0 1237938900:2222  # last update >=300s ago

rrdtool dump test.rrd | grep row | grep -Ev '(NaN|0.0000000000e)'
  <!-- 2009-03-24 20:45:00 CET / 1237923900 --> <row><v> 1.2300000000e+02 </v></row>
  <!-- 2009-03-24 20:50:00 CET / 1237924200 --> <row><v> 4.5600000000e+02 </v></row>
  <!-- 2009-03-24 20:55:00 CET / 1237924500 --> <row><v> 7.8900000000e+02 </v></row>
  <!-- 2009-03-24 22:55:00 CET / 1237931700 --> <row><v> 1.1110000000e+03 </v></row>
  <!-- 2009-03-25 00:55:00 CET / 1237938900 --> <row><v> 2.2220000000e+03 </v></row>


This trick probably gets you closest to what you want ...

hth

- Karl



More information about the rrd-users mailing list