[rrd-users] Adding data in the past

Simon Hobson linux at thehobsons.co.uk
Wed Mar 9 12:40:48 CET 2016

Olivier Nicole <Olivier.Nicole at cs.ait.ac.th> wrote:

> I am stuck with aan annoying issue with rrdtool.
> I want to add data in the past but cannot figure how to do so.

You can't<period> That's a design feature, not a bug.

> So far, I have only added data now, but I want to reconstruct an history
> from data gathered from an older log file.

The *ONLY* way to do it is to start a new RRD file, with a start time before your first data point, and then feed the data in in increasing timestamp order. It gets tricky if some of the data you need to enter is actually in an RRD file and has already been consolidated - but that can (mostly) be worked around.

A bit more detail. RRD is not a regular database - it's a highly specialised one designed for one task (originally storing router traffic data). It doesn't have an arbitrary table that can have data inserted willy nilly - it has a circular buffer of predetermined size (set at database creation time) which only supports updated with time going forward (values actually stored depend on previous data).
In fact, other than (IIRC) the last value entered, not a single value you put in is stored ! All stored values are calculated on-the-fly and the data to update a previously entered value and recompute the stored value simply doesn't exist.

Alex has some great tutorials at http://rrdtool.vandenbogaerdt.nl
I suggest starting with "Rates, normalizing and consolidating" and "Describing the past, not predicting the future".

More information about the rrd-users mailing list