[rrd-users] Probleme using several dbs and unknown values

unicsonline unicsonline at gmail.com
Wed Jan 30 14:26:07 CET 2013

Hello Simon,

Thanks a lot for this tips ;)

It seems better but I have now to find how build this formula for any
cases, between one db source to x dbsources (nb of periods -so dbs- is
variable, and my graph command is generated by script)

For the second remark in this case I have not this problem, because I am
sure that I have not more only one values in one db (all others dbs provide
unkown values)

2013/1/30 Simon Hobson <linux at thehobsons.co.uk>

> unicsonline wrote:
> I am tracing a long time graph, where datas are dispatched along different
> dbs
> for example for period1, I use db1.rrd, for period2 I use db2.rrd, etc...
> Of course depending date my infos are present in only one dbs at the same
> time, and requests sent to an other one returns an unknown value.
> My problem is to deal with this unknown values.
> In a first try, I have used a workaround with a cdef adding all the
> values, and replacing unknown ones with a 0 :
> for example, with 3 periods:
> CDEF:TOTAL_period=0,period1,UN,0,period1,IF,+,period2,UN,0,period2,IF,+,period3,UN,0,period3,IF,+
> that works, average and max values are ok, but min and last are
> positionned to 0 (it's normal, because some unknown values are present, and
> are replaced by 0 in syntax)
> In fact the better syntax would be something like :
> if period1 != unkown use period1
> else period2 != unkown use period2
> else period3 != unkown use period3
> else use unknown
> to preserve unknown values.
> There are several ways you can do this. One I used in the past when I was
> switching between two sets fo DBs was to work on date. Basically, if date <
> some fixed value then use A, else use B. I don't recall the syntax I used
> (it was a couple of years ago and I no longer have the code lying around),
> but it wasn't hard.
> But if all you want is the simple expression you've given - ie you will
> only ever use one source - then this would look something like :
> Which means, if A is unknown then use B else use A. You can either use
> multiple CDEFs (easier to see), just expand the one - I'll put brackets in
> this one to show the grouping, you take them out to get a valid expression.
> (A,UN),((B,UN),C,B,IF),A,IF
> Which means If A is unknown then use the result of (if B is unknown then
> use C, else use B), else use A.
> So stripping out the brackets, you getA,UN,B,UN,C,B,IF,A,IF which I think
> should do what you want - unless I've got it wrong of course !
> Bear in mind that if (for example) you consolidate down to daily values,
> and your data collection switched part way through a day, then you'll have
> one day when two sources could have a value. Eg if your measured value was
> a steady 1, and you switched collection at mid day, then A and B would both
> contain 0.5 for that day. This can be worked around if it's a problem - it
> just makes the RPN more complicated.
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20130130/927b9023/attachment.htm 

More information about the rrd-users mailing list