[rrd-users] Design an RRD for the following data

Simon Hobson linux at thehobsons.co.uk
Fri Apr 27 21:58:02 CEST 2007


Goldburt, Dan wrote:

>Apologies if this has been discussed elsewhere, it seems to me like a
>common enough problem but I couldn't find a solution described anywhere.

It has, it is, and there have been - in that order !

>I'm trying to graph stock market volume. As you can see, the data is a
>counter that gets updated roughly every 30 minutes and resets at the end
>of the day:
>
>TIME   	(UNIX TIME)			NASDAQCOMP VOL
>Tue Apr 24 15:00:05 2007 (1177441205)   1798518651
>Tue Apr 24 15:30:05 2007 (1177443005)   1952143339
>Tue Apr 24 16:00:04 2007 (1177444804)   2214507628
>Tue Apr 24 16:30:03 2007 (1177446603)   2306049386
>Tue Apr 24 17:00:02 2007 (1177448402)   2332135566
>Tue Apr 24 17:30:02 2007 (1177450202)   2342303973
>Tue Apr 24 18:00:03 2007 (1177452003)   2345873356
>Tue Apr 24 18:35:01 2007 (1177454101)   2347341668
>Wed Apr 25 10:00:09 2007 (1177509609)   401969956
>Wed Apr 25 10:30:07 2007 (1177511407)   666108171
>Wed Apr 25 11:00:10 2007 (1177513210)   858504492
>
>I'd like to define an RRA with one DS and be able to generate two kinds
>of graphs - trending market activity during the day (trades/sec), and
>trending daily volumes (total trades each day) to see if the market is
>getting busier in the long run. I've thought of several different
>approaches and none of them work sufficiently.
>
>1. I define my DS as a COUNTER. This would give me trades per second,
>but how would I handle the counter reset after every day?

Make sure you do an update just before the counter reset, then when 
the reset occurs, the software will realise and cope with it.

>  Also, I see no way to get the total volume for a day out of the RRA.

Do you understand the concept of average ? If you ask for the data 
with a step size of 86400 then you will get one value/day which will 
be calculated with the agregate function you specify. If you specify 
average then you will get that, and when you multiply by 86400 you 
get the total number of <things> in the day.

>  If my DS type performed some kind of rate of change calculation, 
>how do I integrate the DS to get the actual values back?

You can't. Have you REALLY looked in the archives, this comes up at 
least every week. rrd normalises whatever you feed it to fit the 
sample periods specified when you define the database. Unless you 
feed data samples exactly on sample period boundaries then you CANNOT 
get the original values back.



What you probably want is a database with one ds at a sample period 
of 30 minutes (the original data seems to be approximately half 
hourly), and a second one with average over 24hour periods to give 
you long term storage of the daily average rates.


I suggest RTFM and come back if you still don't see hwo to do it.



More information about the rrd-users mailing list