[rrd-users] rrd graph inter/extrapolation of large U / NaN blocks
Joachim Larsson
joachim.larsson at ericsson.com
Mon Mar 4 13:00:43 CET 2013
Hello all,
Thanks for the input, and sorry for the delay in reply, just had some "real" work interferring with my hobby project :p
Anyhow, i managed to get a "almost" fix by using;
create;
/usr/bin/rrdtool create stocklol.rrd --start $starttime -s 300\
DS:latest:GAUGE:600:0:U \
DS:volume:COUNTER:600:0:U \
RRA:AVERAGE:0.5:1:8640 \
RRA:AVERAGE:0.5:4:52560
graph;
DEF:mylatest=stocklol.rrd:latest:AVERAGE \
CDEF:smoothex=mylatest,86400,TRENDNAN \
CDEF:newx=mylatest,UN,smoothex,mylatest,IF \
LINE2:mylatest#FF0000:"latest price" \
LINE1:newx#00FF00:"woot"
The smooth/trend aaalmost give what i want, atleast during weekdays where the 86400 still has data. Weekends still run out of data from mid sat. The graph is totally fake and not real at all, but atleast there is a line, more visibly pleasing for the eye..
Using PREV gave the following;
ERROR: rpn expressions without DEF or CDEF variables are not supported
and referring to last gave just that, literally the last value entered, and not the last value before the NaN.
Using larger heartbeat gave maybe one or two pixels more, then a gap with the NaN.
If anyone has any other idea im happy to hear them!
Using the last entered value before the gap would result in a straight line, then a jump up/down when the new values are entered, and this is technically how the price updates when the stockmarket openes, and is a valid graph-option.
A line between the last and next update, through the NaN block so to say would also work.
Here is some very ugly ascii-"art", imagine the curve going up and down, with gaps
\_/'''\__[gap]___--_/'[gap]--
would become
\_/'''\__________--_/''''''--
Sincerely,
Joachim
-----Original Message-----
From: rrd-users-bounces+joachim.larsson=ericsson.com at lists.oetiker.ch [mailto:rrd-users-bounces+joachim.larsson=ericsson.com at lists.oetiker.ch] On Behalf Of Alex van den Bogaerdt
Sent: den 27 februari 2013 23:08
To: rrd-users at lists.oetiker.ch
Subject: Re: [rrd-users] rrd graph inter/extrapolation of large U / NaN blocks
You are asking for a straight line between two points in time. What is not really clear (to me at least) is if you want a straight horizontal line, continuing the last known update, or if you want a sloped line.
Other approaches, in addition to what Steve already suggested:
In case of a straight horizontal line repeating the last known value:
Your update program could remember and fill in the last known update, and just keep feeding that to your RRD every 5 minutes.
In case of a sloped line:
At 8am CET the first update is a special case. Read the last known value from the database, using rrdgraph with a PRINT statement, or get it using external sources, compute the difference between closing and opening, divide by the number of 5-minute periods (which will NOT always be 168, think about daylight saving!) and do the 168, or 156, or 180 updates. This would be a function of your script around RRDtool, not for RRDtool itself.
just thinking out loud, HTH
Alex
----- Original Message -----
From: "Joachim Larsson" <joachim.larsson at ericsson.com>
To: <rrd-users at lists.oetiker.ch>
Sent: Wednesday, February 27, 2013 2:49 PM
Subject: [unsure] [rrd-users] rrd graph inter/extrapolation of large U / NaN blocks
Hello,
Im web-scraping a stock-market page which is only open daytime, thus my rrd-database will have huge gaps in the data. I've been trying to make a CDEF that uses old values and tries to inter/extrapolate the gaps, but to no avail.
Can anyone shed some light regarding converting U to a straight line between the previous and last successful rrd data?
I create the rrd with the following;
rrdtool create stocklol.rrd --start $starttime -s 300\ DS:latest:GAUGE:600:0:U \ DS:volume:COUNTER:600:0:U \ RRA:AVERAGE:0.5:1:8640 \ RRA:AVERAGE:0.5:4:52560
The data is being updated 0800 -> 1800 CET, all other values are NAN / U
Google and other sources doesnt hint on this, as far as i could tell. Alot of refrences to making unknown into 0, but that's absolutely not what i want. I checked the CDEF and RPN docs refrenced in rrdgraph pages.
Sincerely,
Joachim
--------------------------------------------------------------------------------
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
>
_______________________________________________
rrd-users mailing list
rrd-users at lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
More information about the rrd-users
mailing list