2

I'm attempting to read "historical" data from a text file and store in rrdtool to graph later.

I have created a new (empty) rrd database with

$ rrdtool create monitor_db.rrd --step 900 DS:col1:GAUGE:900:0:1000 DS:col2:GAUGE:3600:0:1000 RRA:MAX:0.5:1:1500

Then I attempt to update the database but I get an error

$ rrdtool update monitor_db.rrd --template col1:col2 1404249680:2:3
ERROR: monitor_db.rrd: illegal attempt to update using time 1404249680 when last update time is 1422146997 (minimum one second step)

The timestamp that rrdtool clains is the last update time, 1422146997, is now and I'm trying to insert data from roughly half a year ago.

I understand that you have to insert data in chronological order to rrdtool, but the database should be empty since I have tried removing it and re-creating it.

benedikt
  • 95
  • 2
  • 7

2 Answers2

3

Rrdtool create has the --start option which does what you need without changing time for whole system. Defaults to 10 seconds ago.

Paul Haldane
  • 4,517
  • 1
  • 21
  • 32
1

Before creating the database, I needed to change my system time.

  1. Set system time so that it was earlier than the first timestamp in my dataset. In my case: 1404249680 (2014-07-02T21:21 in ISO format).
  2. Create the databse with rrdtool create.
  3. Restore system time to normal.
  4. Update the database with rrdtool update.

Editing the file attributes with touch -d wasn't enough, the starting date is probably stored somewhere in the database file.

benedikt
  • 95
  • 2
  • 7