[rrd-users] Re: Some advice.

alex at ergens.op.Het.Net alex at ergens.op.Het.Net
Sun Jun 11 12:16:28 MEST 2000


Winton Davies wrote:
>   I think I have it - it was the heartbeat variable that was wrong - 
> it needed to be > than 24 hours, rather than =.

If you enter data on day 1 at 00:00 and you enter data again on day 2
at 04:00, I think it needs to be 28h ...

> Next thing - the FETCH command is now working, but instead of a bunch 
> of nice integers, they have been
> changed to float's which are obviously some kind of interpolation 
> between the actual data I entered....

That's by design. Workaround explained below.

> Can someone explain this - how do I avoid this, or is it just giving 
> me the points between ? Looking
> at the dump though, it definitely seems to have lost the original 
> data I put in, which means I couldn't get
> the price point right.

You cannot keep the original data unless you create a database which
can store data for each and every second in the timespan you wish to
keep your data.  Suppose you want to keep your data for a year, you
would need 366 days times 24 hours times 60 minutes times 60 seconds
times the number of commodities.
This means: 366*24*60*60 == 31,622,400 rows per commodity.
Each row will need several bytes to store its value --> you get a
very large database!  Apart from this, it shouldn't be a problem.

If you *always* enter the data at a time where "seconds" equals zero,
you can keep your data by the minute.  This saves 59*527040 rows.
Same story if you always enter on whole hours, you only need 8784 rows.
WARNING: if you create a database that stores per-day you need to
enter the data on each midnight UTC time.  You only need 366 rows then.

> Let me explain again perhaps. Once a day (at some time during the 
> day), I find out whether the price
> of commodity C is $X dollars. Next Day (again sometime during the 
> day, not the same time), I find out
> it is $Y dollars. The day after it might be $Y dollars again.

You need to define for yourself what "some time" can be.  Is it in
"hh:mm:ss" format or in "hh:ss" format?
Do you need to know afterwards what this time was or is it good enough
to know that it was at or after a certain point in time?
If this price is valid during the day, it doesn't matter at what time
you do your sample.  Just give it to RRDtool as if it was sampled at
midnight.

> rm new1.rrd
> rrdtool create new1.rrd  --start  929217466 --step 86400 

"step 86400" means that you have one sample per day.  See above near
the warning.  If you want to create a graph that changes at midnight
and if you do not live in an area where UTC time applies during the
whole year, you might be better off by creating a database that keeps
per-hour values.  Just enter data once a day and RRDtool will fill in
the same value for each hour (provided that heartbeat allows this).

> DS:price:GAUGE:86500:U:U RRA:MAX:0:1:365

"86500" means that you need to input your value somewhere inbetween
00:00:00 UTC and 00:01:40 UTC.  Are you sure you want this?

If I need to store per-day prices I would create a database that keeps
the data per hour (so: 366*24 rows).  If I should be able to enter the
values only at midnight, there's no problem with a heartbeat of 86400.
The step time should be 3600.

Suppose I find out todays price is 60 USD, and suppose this price is
valid for this whole day.  I would not use the current time but rather
the next midnight:

date -d 00:00 +%s ---> 960674400  (Sun Jun 11 00:00:00 CEST 2000)
Add one day:
960674400 + 86400  ==  960760800  (Sun Jun 12 00:00:00 CEST 2000)

rrdtool update new1.rrd 960760800:60
RRDtool will now fill 24 hours with the value 60.  These hours are
exactly what I need, Sun Jun 11 00:00:00 'till Sun Jun 11 01:00:00 is
the first, Sun Jun 11 23:00:00 'till Sun Jun 11 24:00:00 is the last.

For historic data, you can enter several values in one command:

The times are in CEST (one hour east of UTC, summer time applied) and
are midnight on June 2 (so: price for June 1) until June 12 (for today)

rrdtool update new1.rrd 959896800:60 959983200:61 960069600:64 \
     960156000:62 960242400:59 960328800:60 960415200:61 960501600:62 \
     960588000:57 960674400:56 960760800:55


regards,
-- 
   __________________________________________________________________
 / 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 |
+----------------------------------------------------------------------+
| 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



More information about the rrd-users mailing list