[rrd-users] Infrequent events?

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Fri Mar 13 16:04:32 CET 2009


----- Original Message ----- 
From: "Jeremy Dunck" <jdunck at gmail.com>
To: <rrd-users at lists.oetiker.ch>
Sent: Friday, March 13, 2009 3:39 PM
Subject: [rrd-users] Infrequent events?


>I have some events that are fairly rare, so I'd like to keep a metric
> which is days-between-event.  For example, # of days between factory
> accident.
>
> Is there a reasonable way to do this with rrdtool?

Two possible ways to approach this problem:

#1

There is no real difference between {days per event} and {events per day}. 
It's just y=1/x. You are still bound by the X-axis displaying time though.

Set heartbeat high enough.
Use an ABSOLUTE type input.
Update with "1" everytime an incident occurs.  RRDtool will then divide 1 by 
the amount of time lapsed between this update and the previous one.

When graphing, fetch the rate, then use a CDEF similar to CDEF:y=1,x,/
(the number 1 is wrong, that I do know. You figure out if it should be 86400 
or 1/86400)

Problems you may encounter:
* heartbeat still set too low for your purpose
* loosing precision, which will introduce errors
* people expect to see a whole number of days, not some fraction

You can experiment a bit.  Write a script which generates a database, inputs 
some events at semi-random times, look at the resulting graph.

#2

For each day, log the number of accidents during that day (or: log either 0 
or 1, as a boolean value).

Create a database with an RRA which has one day per entry.
Work in UTC time. Update with a timestamp of midnight UTC.
When viewing a year's worth of data, you hopefully see a lot of blanks (no 
accidents) and a bar for each day an accident happened.


HTH
Alex



More information about the rrd-users mailing list