[rrd-users] Average calculations for working hours only, but 7x24 stored

Ralf Kruedewagen ralf-buero at kruedewagen.de
Sat Nov 12 10:03:46 MET 2005


Good morning,

how I can calculate an average depending on time (time of day, day) ? For 
example calculating the average only of working hours. But let's explain me a 
bit more.

My situation:
Let's say I have a RRDtool database containing a single DS "response_time". I 
collect data every 15 minutes and store it to the database. I do that 7x24 
hours every day of a year. I can easily calculate the average of the response 
time for a day, a week, a month or a year. So far, so good.

My challenge:
My boss wants now to get an average (day, week, month, year) of the same DS, 
but in addition to 7x24 also within working hours from Monday to Friday 
between 09:00 and 17:00.

My alternatives / ideas:
1) I could store a second DS "response_time_wh" to the same database. I would 
then update the 1st DS every time but the 2nd DS only within these working 
hours.

Disadvantage: I need to know in advance which time I need to start and stop 
(working hours) filling the 2nd DS. That's not flexible, since the working 
hour could not be changed to 08:00 afterwards.

2) Is there any tricky RPN expression to do that, maybe embedded in a small 
script for matching day of a week and hours to UNIX timestamps ?

Advantage: Filter expression can be changed later. Interactive calculations 
possible (web form). And, I could also filter out time ranges which are 
defined as "scheduled downtime".

>From RPN tutorial I know that it is possible to define something for a single 
timeframe. But for a monthly average I need to filter out a lot of "unwanted" 
time ranges. With SQL this would be no problem, but with RRDtool I have my 
problems.

Any idea on how to go for alternative No. 2 ?

Best Regards and thanks for your help in advance
Ralf


--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list