[rrd-users] what to do with data that resets every day

Alex van den Bogaerdt alex at ergens.op.het.net
Fri Mar 2 06:31:33 CET 2007

On Thu, Mar 01, 2007 at 06:28:29PM -0500, Joey Rutledge wrote:
> I am trying to setup some graphs on total connections (mail server)
> and am getting data from the application via a web dashboard.  The
> application resets the data for total connections on a daily basis
> back to zero and essentially does a total count of connections for
> each day (COUNTER).  I want to be able to setup some rrd graphs with
> this info but can't figure out the best way to go about this.  Has
> anyone had to work with data like this and if so what how did you
> handle the ever so frequently reseting of the data to zero?

You get statistics during the day?

Use DERIVE.  Set minimum allowable value to zero.

As soon as you get the statistics, update your database using this value
and use a timestamp reflecting reality.  Repeat until you got the last
value.  Then do another update, slightly later, with value zero.

If there is some time between the last update and the counter reset,
just update your RRD another time using the same last value before
you update with zero.

The interval between the last two updates will become unknown because
the rate will be lower than allowed.  You can also use COUNTER with a
sufficiently low maximum setting, but using DERIVE is safer.

Try if you can use microsecond precision for the zero-update, else update
one whole second later. Smaller is better in this case.

The next update (which can be anywhere during the day, provided that
heartbeat allows it) will count from zero again.

This is, by the way, the same procedure I recommend for deliberate
router (and such) reboots.  There's no difference: the counter is
set back to zero.

If you get only one value a day, always at the same time, you could
also use GAUGE and divide the value by 86400 (at update time in your
script, or at graph time using a CDEF).  This too will result in a
rate, and does not have that small unknown interval.

Alex van den Bogaerdt

More information about the rrd-users mailing list