[rrd-users] How to graph delta from last

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Tue Aug 4 11:17:52 CEST 2009


----- Original Message ----- 
From: "Niobe" <ben.carbery at gmail.com>
To: <rrd-users at lists.oetiker.ch>
Sent: Tuesday, August 04, 2009 2:27 AM
Subject: [rrd-users] How to graph delta from last


>
> I want to graph the change in the number of bytes or lines in a file (very
> large syslog files) since the last poll. The files are rotated every night
> back to zero.
>
> I have a script which is returning the data, my question is what DS type 
> to
> store it with. None of guage, counter, absolute or derive seem quite 
> right.
>
> Reading the docs I came up with 2 possibilities
> - Using GUAGE with a CDEF that subtracts LAST
> - Using DERVICE with a CDEF that multiplies it by the polling interval.
>
> Are either of these correct or is there a more efficient way?


COUNTER, or DERIVE with a minimum allowed rate of zero, seems to be the best 
for this, indeed combined with a CDEF to multiply by the last interval.

When the logfile is rotated, you know the file size is zero. Try telling 
that to RRDtool as well. You can do this by giving it three additional 
updates at the moment logrotate runs. Usually you are able to run a script 
from your logrotate script, before rotating.

if "T" is the time when logrotate does its thing:

At T, update with the current size of the logfile
At T+1, update with U (unknown)
At T+2, update with 0 (zero)

Now you loose as little as information possible.

You also need to prevent the two mechanisms (the script run from logrotate, 
and your periodic update command) to clash. You could, for instance, run the 
update processes between 03:00 and 01:55, and let logrotate do its job 
somewhere between 02:00 and 02:55. Or, if this is unacceptable, create some 
kind of locking mechanism which prevents the regular updates from doing 
their work when logrotate does its job.

If RRDtool complains that the database was already updated at T or at T+2, 
no problem but you do not want your regular update process to update at T+1.

HTH
Alex



More information about the rrd-users mailing list