# [rrd-users] Re: price graphing..

Alex van den Bogaerdt alex at ergens.op.HET.NET
Wed Mar 6 00:48:04 MET 2002

```Michael Hostbaek wrote:

> In my Oracle DB, I have some prices on, let's say P4 CPU's.. Let's make
> up some prices:

[snip prices]

> Now, I would like to make an rrd that I could feedthis information to
> every 5 hour, and I would like to be able (every 5 hour) to create a
> graph, that will show me the following three lines:
>
> minimum price
> maximum price
> average price

Doable.

> Furthermore, I'd like a graph for the last 24 hours, and one week graph,
> and a month graph.
>
> I am at a loss, when creating the rrd - I am messing around with DERICE
> and GAUGE.. the RRA completely confuses me, what should be used with
> AVERAGE, MAX and MIN ? What are the values ?

You shouldn't do any processing on the values.  They are gauges.

When you enter a price into RRDtool, this price will be moved into
an RRA when the time is right.  What is this moment in time you ask?
Simple: the number of seconds since the unix epoch should be a whole
multiple of the step size times the number of steps per CDP.

Numeric example:  your step size is one hour, the number of steps per
CDP is one, this means that each interval in that RRA ends at some
number times 3600 (say 1015369200 which is 282047*3600).

If your step size (as defined by "rrdtool create --step ...") is 300
seconds (the default) and you store 12 of such intervals in one CDP,
the total duration of one CDP is, again, 3600 seconds.

If you would have CDP durations of 24 hours, make sure you understand
what this means.  Each and every interval *will* end at n*86400 thus
it will never occur at midnight your local time.  Even in the UK the
local time will not match UTC during daylight savings. So: each row
should probably represent less than one day.  Same reasoning can be

Next question:  *what* is going into the RRA.  Well, if the RRA stores
minima, the lowest number seen in that interval is going to make it
into the RRA.  If the RRA stores maxima, the highest is going in.

I've choosen to use one hour in this example as this is the most
appropriate number in your case IMHO.

What you should do is:
- create a database that has a step time of one hour
- this database should contain
- an RRA for the minima
- an RRA for the maxima
- an RRA for the averages
- the length of each RRA is something you get to choose; if you want
to keep data for a year you need 24*365=8760 rows in each
- the heartbeat should be set to at least 18000 (5 hours)
- min and max should be set to appropriate values (when known)

Now update the database every 5 hours, preferably using timestamps
that are whole multiples of 18000.  Each update will then populate
5 rows in each of the RRAs at a time.

When you graph the database, RRDtool will automatically consolidate
the data into suitable intervals.

The graph script can just ask for data from the minimum, maximum or
average RRA.  If you also print the values (using PRINT or GPRINT)
make sure to get the minimum of the minima, maximum of the maxima
and average of the averages.

If you need more than this, ask specific questions.  Do so on the list

cheers,
--
__________________________________________________________________
/ alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
+----------------------------------------------------------------------+
| Technical questions sent directly to me will be nuked. Use the list. |
+----------------------------------------------------------------------+
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |
+----------------------------------------------------------------------+

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