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

Alex van den Bogaerdt alex at ergens.op.het.net
Sun Dec 1 12:31:53 MET 2002


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
> (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.

Example CDEF:

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

How does this work:

- hour11 is the resulting data
- input is the original data (such as frequently used "ds0")
- LTIME,86400,% is the time stamp for this data, in local time,
  modulo one day (time 0 to time 24*3600-1)
- 39601,43200,LIMIT,UN  Do NOT include the sample at 11:00 as
  this is for time 10:55 to 11:00, DO include the sample at
  12:00 as this is for time 11:55 to 12:00.  The LIMIT results
  in either unknown (for times before 11:00 or after 12:00) or
  in the original time stamp.  UN is used inside the next IF
  statement
- UN,UNKN,input,IF   Return unknown data or return input, depending
  on the outcome of the time check.

Now show the average of hour11 and you should get what you asked for.
Note that 39601 is 11*3600 +1; without this "+1" you'd also include
the interval from 10:55 to 11:00 which is not what you want.

HTH
Alex

--
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
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list