Discussion:
[rrd-users] Concatenate 2 RRD without overlap or sum
(too old to reply)
topgunx1
2015-03-20 15:45:05 UTC
Permalink
Hello,
first of all thanks for this mailing list!

I would ask you the following question.

I should draw a graphic with the values (IN/OUT) of 2 NICs.
I wouldn't like that graphs overlap or sum
I need to placed RX1 above the RX2 (starting from Y-0),
and TX1 above TX2 (newly starting from Y-0).


Here is my snippet config with overlap RX1, RX2, TX1 and TX2:
-----
$a = first.rrd
$b = second.rrd

[..]

"DEF:in-a=$a:in:AVERAGE",
"DEF:out-a=$a:out:AVERAGE",
"CDEF:bitin-a=in-a,8,*",
"CDEF:bitout-a=out-a,8,*",

"AREA:bitin-a#00A0007F",
"LINE1:bitin-a#00A000FF",
"LINE1:bitout-a#002A97FF",

"DEF:in-b=$b:in:AVERAGE",
"DEF:out-b=$b:out:AVERAGE",
"CDEF:bitin-b=in-b,8,*",
"CDEF:bitout-b=out-b,8,*",

"AREA:bitin-b#00C9007F",
"LINE1:bitin-b#00C900FF",
"LINE1:bitout-b#000000ff",
--------

How can I do this?
Who help me?

Thanks in advance.

Regards.
Top



--
View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/Concatenate-2-RRD-without-overlap-or-sum-tp7582870.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.
Simon Hobson
2015-03-20 16:31:09 UTC
Permalink
Post by topgunx1
I should draw a graphic with the values (IN/OUT) of 2 NICs.
I wouldn't like that graphs overlap or sum
I need to placed RX1 above the RX2 (starting from Y-0),
and TX1 above TX2 (newly starting from Y-0).
You mean, at some point T you switched things round, and you want the graph to switch around as well ?

Without going and looking stuff up (really busy right now), it's similar to the "I started a new RRD at time T and want to use the old one up to that point.

I used something like :
CDEF:aa=a,unkn,timestamp,t,lt,if
CDEF:bb=b,unkn,timestamp,t,lt,if
CDEF:cc=b,unkn,timestamp,t,ge,if
CDEF:dd=a,unkn,timestamp,t,ge,if

Then plot aa, bb:stack, cc, dd:stack
For where I've put "timestamp", you'll need to check the docs, there's a function which returns "the timestamp of the value being processed".
topgunx1
2015-03-24 10:31:40 UTC
Permalink
Hello Simon,

thanks for your answer.

Sorry but I'm not so expert in rrd for implementing what you have suggested
me.

Is it possible for you correct my script (I know you are very busy!)?

Best Regards.
Top



--
View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/Concatenate-2-RRD-without-overlap-or-sum-tp7582870p7582872.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.
Simon Hobson
2015-03-25 10:21:40 UTC
Permalink
Post by topgunx1
Sorry but I'm not so expert in rrd for implementing what you have suggested
me.
Then treat it as an opportunity to learn !
Post by topgunx1
Is it possible for you correct my script (I know you are very busy!)?
No, but I'll get you started. See http://oss.oetiker.ch/rrdtool/doc/rrdgraph_rpn.en.html

Assuming you have a DEF of "a" which is the first value you want up until (and including) time t, then this should give you a value up until time t and unknown after that :
CDEF:aa=a,UNKN,TIME,t,LE,IF

Breaking that down:
"TIME,t,LE" means :
Push the time the currently processed value was taken at onto the stack, push the value t onto the stack, if the first was less than or equal to the second then push true onto the stack, else push false.
"a,UNKN,<something>,IF" means :
push a onto the stack, then push unknown onto the stack, then push <something> (the result of the If statement) onto the stack. If that <something> is true then take the a, else take the unknown value.

You need to replace "t" with the numerical value. I tend to use Bash and dynamically generate the RRD scripts, so the above would become "CDEF:aa=a,UNKN,TIME,${t},LE,IF" where t is previously defined/calculated in the script. If you are writing a static script, then use the numerical value.

Further hints.
Don't try to write the whole script and then debug it. Just do one DEF and CDEF and graph that (you should have an area that stops abruptly at time t). When you have that working then you can start adding the other parts.
Don't forget that you need to use "LE and "GT" or "LT" and "GE" depending on whether you want time t to be the older data set or the newer one. If you use LT and GT then there's be a very small gap, if you use LE and GE then both sets will be included at time t and there's be a blip in the data.
Loading...