[rrd-users] Re: graphing averages over a week?

Clifton Royston cliftonr at lava.net
Thu Feb 15 19:19:43 MET 2001

On Thu, Feb 15, 2001 at 10:31:21AM +0100, Paul Slootman wrote:
> On Wed 14 Feb 2001, Philip Molter wrote:
> > 
> > Yeah, but that's not quite what he's talking about.  What he wants
> > is a graph that would be 24 hours long, but would represent data
> > from the past week.  What he really wants is basically a bar graph
> > for discrete sections of time showing average usage during those
> > discrete sections of time.
> Uh, yes, that's what I meant to say :-)

There might actually be a "sneaky" way to do this: 

1) Create an RRD with 7 times the number of DS entries you need, or 8
if you want an entry which represents the average.

2) On every update, when you are doing the update with today's data,
first pull out the data for the same time on the previous day, so you
can "roll" each one to the next DS, and store a newly calculated
average to the last.  That is, each update would do:

 ds[0][now] <- new data, ds[1][now] <- ds[0][now-24hrs], 
 ds[2][now] <- ds[1][now-24hrs], etc.
 ds[7][now] <- avg( new data, ds[0][now-24hrs], ... ds[6][now-24hrs])
3) Now you should be able to use RRD::Graph at any point to graph
either a superposition of the last 7 days, and/or the rolling average
of the last 7 days.

  If you only want it for weekdays, you could modify the above formulas
for what you pull out and store back accordingly.  (You only need 5
DSes, etc.)

> > Yes, I think what you're going to need to do is generate the averages
> > on your own and then plot a temporary graph.  I wouldn't recommend
> > using RRD to generate the temporary graph as the RRD creation time
> > is going to take a little bit of time.  Just pipe the stuff into,
> > for example, GD::Graph (if using Perl) to get what you need.
> I was afraid of that, hoping there was some ready solution.
> Thanks for confirming my fears. I'll start hacking...

  The above might not be totally what you want, but might be easier to
hack than starting from scratch.

  -- Clifton

 Clifton Royston  --  LavaNet Systems Architect --  cliftonr at lava.net
      The named which can be named is not the Eternal named.

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