With rrdtool, database updates should rather take place evenly at the
beginning of each update interval. If it happens at random places
within the interval, rrdtool will try to interpolate the data to make
it "fit better" within the data points. This causes unexpected data
values to be generated into the database.
Make each updates happen consitently at the beginning of the window to
ensure the graphs contain as good raw samples as possible.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
int rrdtool_update_data(struct rrd_database *rrd)
{
- rrd->last_update = time(0);
+ time_t now = time(0);
+
+ /*
+ * This will put our last update slightly into past, but
+ * ensures our update interval will not drift over time.
+ */
+ rrd->last_update = now - now % rrd->interval;
return queue_work(WORK_PRIORITY_HIGH, "rrdtool_update_data",
(work_fn_t *)do_rrdtool_update_data, rrd);