# [rrd-users] Re: Profile by time of day and day of week

Sun Dec 1 23:00:06 MET 2002

```Alex van den Bogaerdt wrote:
> On Sun, Dec 01, 2002 at 01:38:46AM +0100, Luc Moreau wrote:
>
>
>>I'm new to this list. I'm trying to investigate ways of averaging
>>variables by time of day (over a sequence of days) or even day of week

To make my request even more clear (I hope), what I'm interested in is a
moving average of this variable by time of day and day of week.  This
Monday's 10am value should be computed (for instance) as 10% of the new
value of that variable + 90% of last Monday 10am (unless the latter is
unknown, in which case I could take 100% of the new value).

>>(averaging all Mondays at 10am).  Is there support for this in RRD ?  As
>>far as I can see, I can record the raw data with RRD but the kind of
>>averaging I want to do, it seems I'll have to do it by external
>>programs.  Did I miss something obvious ?

> As far as I know, averaging will discard NaN values.  This means you
> can create a CDEF that, for instance, only "passes through" data from
> 10:00 to 11:00 and average this.
>
> Create 24 of such CDEFs and you have an hourly distribution.

I tried your method with some success;
>
> Example CDEF:
>
>    CDEF:hour11=input,LTIME,86400,%,39601,43200,LIMIT,UN,UNKN,input,IF

I think you don't need the first reference to "input" in the above CDEF.
It will be left back on the stack and RRD detects that the stack depth
is > 1 with the CDEF as written.  But that's a detail.  I tested with:

CDEF:hour11=LTIME,86400,%,39601,43200,LIMIT,UN,UNKN,delta,IF

where delta is a variable from my RRD.

>
> How does this work:
... skipped CDEF explanation ...

> Now show the average of hour11 and you should get what you asked for.
This perfectly shows the value (or average value, depending on the
--step used) filtered with the time window in the CDEF.  I tried with
--step 3600 and this gives a neat average between 11:00 and 12:00 each
day.

But if I try to increase the --step, at about 7200 there is nothing
displayed on the graph.  I think that's because I specified a 0.5
"xfiles factor" when creating the RRD, and a step of 2 hours when there
is only data for 1 hour leads to... only 50% valid data.

How do I go about averaging this "hour11" over more than 1 day then ?

Anyway, thanks Alex for your help with this.  I'll go on tinkering more
rrdtool options.  Maybe recreate the RRD with a very low xfiles factor
will help...

Luc

--
Luc Moreau (lucm at advalvas dot be)
Linux (because reboots are for upgrades ;-)

--
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://www.ee.ethz.ch/~slist/rrd-users