[rrd-users] Re: price graphing..
Michael L. Hostbaek
mich at bomb.dk
Wed Mar 6 16:55:57 MET 2002
hmm... I am not sure if I understand correctly.. but anyhows.. but it be
dead wrong to create a rrd like this:
root at mail2 data/rrdtool# rrdtool create cpuprice.rrd --step 3600 \
DS:price:GAUGE:18000:0:500 \
RRA:AVERAGE:0.5:1:720 \
> RRA:MAX:0.5:1:720 \
> RRA:MIN:0.5:1:720
I want to be able to show up to a month back. I do not need a year
graph. The only problem, and question that remainsunsolved is:
today I might get 5 different prices from my DB, tomorrow there might be
6 or even 10... All these values need to go in the rrd. So I should
perhaps create a perl script, calculating the average of my prices. Then
make 3 datasources, one for the average price (at this point of time),
one for the maximum price, and one for the minimum price. (and they
should all be GAUGE's) and then just make one RRA. How would I make that
??? Like this:
rrdtool create newcpu.rrd --step 3600 \
DS:avprice:GAUGE:18000:0:500 \
DS:maxprice:GAUGE:18000:0:500 \
DS:minprice:GAUGE:18000:0:500 \
RRA:AVERAGE:0.5:1:720
and then feed the three values to the rrd every 5th hour ??
I should then be able to create a 24h graph with the following, command:
rrdtool graph prices.gif --start -86400 \
DEF:average=newcpu.rrd:avprice:AVERAGE LINE2:average#FF0000:"Average" \
DEF:max:newcpu.rrd:maxprice:AVERAGE LINE2:max#000000:"Max" \
DEFmin:newcpu.rrd:minprice:AVERAGE LINE2:min#0000FF:"Min"
Would that work ?
Thank you very much for your help and pointers, which are greatly
appriciated !!
Regards,
Michael Hostbaek
Alex van den Bogaerdt (alex) writes:
>
> Michael Hostbaek wrote:
>
> 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
> made up for 5-hour periods.
>
>
> 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.
>
>
--
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