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

j.halifax2 at seznam.cz j.halifax2 at seznam.cz
Wed Jan 30 17:01:20 CET 2013




>  how build this formula for any cases, between one db source to x 
dbsources



..do you mean something like that?




$per=(period0, period1,.....,periodmax,periodknown);  # all periods as 
defined in your visualizing system, plus the next (last) known

$gentext=(<text0>, <text1>,...,<textmax>,<unknown>);  # texts to be 
generated for periods as above

# The  is_unknown function below returns 1 for unknown period argument, 
otherwise 0

$i=0; while(is_unknown(per[$i]) == 1) $i++; 

print $gentext[$i];




BR

jh








---------- Původní zpráva ----------
Od: unicsonline <unicsonline at gmail.com>
Datum: 30. 1. 2013
Předmět: Re: [rrd-users] Probleme using several dbs and unknown values

"

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
(mailto: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 :

A,UN,B,A,IF
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(mailto:rrd-users at lists.oetiker.ch)
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
(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/f8ab6914/attachment.htm 


More information about the rrd-users mailing list