[rrd-users] Dynamic Steps
Oliver Loch
grimeton at gmx.net
Sun Apr 21 17:43:27 CEST 2013
HI,
Am 20.04.2013 um 11:17 schrieb Alex van den Bogaerdt <alex at vandenbogaerdt.nl>:
> Please just do some experiments with fake data.
>
> Create two databases with the same property, ABSOLUTE counter type. Update
> them using the same timestamps (do not use "N"), four times a second, and
> make sure there is enough data to fill a couple of timeslots in your RRA.
>
Using the same timestamp again gives me an error. This is what I did:
Wrote a script:
#!/usr/bin/env bash
set -x
file=test.rrd
ts=$(date +%s)
rrdtool create test.rrd -s 1 DS:gpio0:ABSOLUTE:14400:1:15000 RRA:AVERAGE:0.5:60:500
for i in {1..3}; do
rrdtool update test.rrd ${ts}:3600;
done
and then executed it, with the following results:
root at LePi:~/tests# ./ts
+ file=test.rrd
++ date +%s
+ ts=1366557702
+ rrdtool create test.rrd -s 1 DS:gpio0:ABSOLUTE:14400:1:15000 RRA:AVERAGE:0.5:60:500
+ for i in '{1..3}'
+ rrdtool update test.rrd 1366557702:3600
+ for i in '{1..3}'
+ rrdtool update test.rrd 1366557702:3600
ERROR: test.rrd: illegal attempt to update using time 1366557702 when last update time is 1366557702 (minimum one second step)
+ for i in '{1..3}'
+ rrdtool update test.rrd 1366557702:3600
ERROR: test.rrd: illegal attempt to update using time 1366557702 when last update time is 1366557702 (minimum one second step)
root at LePi:~/tests#
So using the same timestamp multiple times per second doesn't seem to work for me.
> Feed 3600 into one RRD every time, feed 1 into the other RRD every time.
>
> You should see a rate of 14400 in the first, and 4 in the other.
>
> Now use a CDEF to multiply 4 by 3600, and you get 14400 again. Same
> resulting rate, other way to achieve it. The resulting databases have
> Joules/second in the first, and Wh per second in the other. That CDEF
> transforms Wh into J, because 1 Wh is just 3600 J.
>
> Do not confuse this with another reason to multiply by 3600. You have been
> asking about 'per hour' rates. If you have 1 Wh per second, constantly, then
> after an hour you will have used 3600 Wh. So if you multiply a rate by 3600,
> you get 'rate per hour' instead of 'rate per second'.
>
> If your database contains Wh, and you want to know Joules/hour, then you
> need to multiply by 3600 twice (or one time by 12960000, for performance
> reasons).
>
The joules thing is something you started to talk about. Not really my problem. And I know that I get 3600W/h when I have one watt/hour per second. Its simple math, but at the moment it doesn't seem to be possible to update multiple times per second.
> And to answer your question about where RRAs get their data: it is already
> described. PDPs are used to build CDPs. See the three phase description
> again. If RRAs get their data from other RRAs, it would have been described
> there.
So just for my understanding: If I want to have an RRA that holds the daily average of the power consumption over a month, I need to create an rrd with 86400 PDPs? And If the average should be covered on a weekly basis over a month, I'd need an RRD with 7*86400 steps and it needs to be created like this:
rrdtool create test.rrd -s 1 DS:some-input:ABSOLUTE:14400:1:15000 RRA:AVERAGE:0.5:604800:52
?
> Really, you are thinking and assuming a lot, but you do not verify this by
> experimenting.
>
I'd prefer verifying things with the help of documentation. And I'm not assuming anything, I'm asking how something could be done and present an idea I had to verify if it is possible this way. But it doesn't seem to be, so thanks for that.
> Start simple. Step==60 (meaning: every step is 60 seconds). Update with
> timestamps that are a whole multiple of 60 (n*60). Start simple with three
> RRAs, one using 1 PDP per CDP, one using 2 PDP per CDP and one using 3 PDP
> per CDP. See what happens, and when it happens, by examining the resulting
> RRD every time between updates.
>
> Later you start updating with timestamps that are not a whole multiple of 60
> seconds, e.g. at n*60+10, and you learn about normalization.
>
I know how normalization (standard score) works. It's not black magic to me. But the question if writing multiple values to the database per second then leads to a max value in the PDP or to the average in the PDP (yes, the PDP, multiple updates per second -> normalization -> PDP), hasn't been answered till now. Asking again then lead to your statement that it would be better to multiply the value outside rrdtool first and then write it to rrd.
Facing the fact, that it doesn't seem to be possible to update multiple times with the same timestamp, I'd say that either I'm missing something (timestamp with mili-/microseconds perhaps?) or that something else doesn't seem to work. Again: that's why I'm asking for it here.
Thanks.
KR,
Oliver Loch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4343 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-users/attachments/20130421/4e1b16e7/attachment.bin
More information about the rrd-users
mailing list