[rrd-users] Rrdtool for counting irregular events

Simon Hobson linux at thehobsons.co.uk
Sat May 19 20:50:20 CEST 2012


Rafal Gwizdala wrote:

>Can rrdtool be used for measuring frequency of irregular events? I 
>mean the updates would occur in irregular patterns and I'd like to 
>measure the frequency of them / number of occurrences per some base 
>interval.

It's tricky - you can do it but there are significant compromises needed.

Firstly, you can set a long heartbeat value. That will allow you to 
go a long time between updates without making the data become 
unknown. But that alone will not deal with all the problems.

If you only update infrequently then you'll get some strange results. 
Say you had an update at midnight, and then the next update wasn't 
until the next midnight. Assuming heartbeat is long enough, then the 
second update will result in the whole day being set at a uniform 
(and very low) rate - eg if there were 3 events, then the rate would 
be 3/86400 = 3.47e-5. Also, for the whole day, any graphs would show 
as unknown - because until the second update, RRD cannot know what 
value you may put in and hence it cannot "close off" any time steps.

Alternatively, if what you are saying is that you'll enter an update 
of "1" each time <something> happens, then again you'll find yourself 
with unknown data from the last completeted step until the next 
update occurs. Then the whole period will show as a very low rate.
The later you should be able to work around by doing an update with 0 
before each update with 1. Then you'll see long periods with a zero 
rate, interspersed with short periods with a not so low rate. If your 
step time was (say) 5 minutes (300 seconds), then a single event 
within a 5 minute step time would result in a 5 minute period of rate 
1/300 = 3.33e-3.

In order to get the unknown data to "go away", you could periodically 
update with a value of 0 which will "complete" some step periods so 
they show a value (mostly 0) instead of unknown. You will need to 
figure out how to avoid clashes if the periodic update happens at the 
same time as a real event.

-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.



More information about the rrd-users mailing list