Discussion:
[rrd-users] RPN for max of list of nodes
(too old to reply)
Aaron Thomas Holt
2015-06-25 21:04:59 UTC
Permalink
Hi all,

I currently have a legend formatted like a table like the one below:

min max average
node01 123 123 123
...
nodeNN 123 999 123

I would like a line that displays the maximum for all nodes that looks
something like what follows:

overall max: 999, node NN

min max average
node01 123 123 123
...
nodeNN 123 999 123

Looking at the RPN documentation it looks possible to find the max value
with a CDEF, but is there a way to find the associated node as well?

Thanks,
Aaron
Steve Shipway
2015-06-25 21:17:00 UTC
Permalink
The short answer is no, you cannot do this in RPN.



The longer answer is that, if you want to do this, you’ll need to do some pre-processing in separate code, and then just use a COMMENT definition to insert the nodename.



This is because of two things –

1. RRD variables are numeric only, not text. So you cannot have a variable holding the node name, though you could in theory just hold the NN numerical index.

2. There does not currently exist an RPN function for ‘MAXINDEX’ or similar; IE, give the *index* of the max value in the list rather than the max value itself. This would possibly be a nice enhancement to create though.



Steve



Steve Shipway

***@auckland.ac.nz

(GNU Terry Pratchett)



From: rrd-users [mailto:rrd-users-bounces+s.shipway=***@lists.oetiker.ch] On Behalf Of Aaron Thomas Holt
Sent: Friday, 26 June 2015 9:05 a.m.
To: rrd-users
Subject: [rrd-users] RPN for max of list of nodes



Hi all,



I currently have a legend formatted like a table like the one below:



min max average

node01 123 123 123

...

nodeNN 123 999 123



I would like a line that displays the maximum for all nodes that looks something like what follows:



overall max: 999, node NN



min max average

node01 123 123 123

...

nodeNN 123 999 123



Looking at the RPN documentation it looks possible to find the max value with a CDEF, but is there a way to find the associated node as well?



Thanks,

Aaron
David Thornton
2015-06-25 21:23:48 UTC
Permalink
first define the maxes for each host:

https://oss.oetiker.ch/rrdtool/tut/cdeftutorial.en.html

then you can use the "if then else" on each var.

https://oss.oetiker.ch/rrdtool/tut/rpntutorial.en.html

I've done this before. You write a script that has an "if then else" for
each host in sequence:

something like this;

DEF:a=router1.rrd:link1in:MAX
DEF:x=routerx.rrd:link1in:MAX
...

if a > b , a, b
if x > (x-1) , x , (x-1)
...

I wrote the script long ago,
and my rpn is tenuous at best :(

and ..x can't get too big... I think I was getting seg faults at like 50
hosts.

David
Post by Aaron Thomas Holt
Hi all,
min max average
node01 123 123 123
...
nodeNN 123 999 123
I would like a line that displays the maximum for all nodes that looks
overall max: 999, node NN
min max average
node01 123 123 123
...
nodeNN 123 999 123
Looking at the RPN documentation it looks possible to find the max value
with a CDEF, but is there a way to find the associated node as well?
Thanks,
Aaron
_______________________________________________
rrd-users mailing list
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
David Thornton
2015-06-25 21:26:07 UTC
Permalink
you want to know what the a b c is that was the max, sorry I misread.

David
Post by David Thornton
https://oss.oetiker.ch/rrdtool/tut/cdeftutorial.en.html
then you can use the "if then else" on each var.
https://oss.oetiker.ch/rrdtool/tut/rpntutorial.en.html
I've done this before. You write a script that has an "if then else" for
something like this;
DEF:a=router1.rrd:link1in:MAX
DEF:x=routerx.rrd:link1in:MAX
...
if a > b , a, b
if x > (x-1) , x , (x-1)
...
I wrote the script long ago,
and my rpn is tenuous at best :(
and ..x can't get too big... I think I was getting seg faults at like 50
hosts.
David
On Thu, Jun 25, 2015 at 5:04 PM, Aaron Thomas Holt <
Post by Aaron Thomas Holt
Hi all,
min max average
node01 123 123 123
...
nodeNN 123 999 123
I would like a line that displays the maximum for all nodes that looks
overall max: 999, node NN
min max average
node01 123 123 123
...
nodeNN 123 999 123
Looking at the RPN documentation it looks possible to find the max value
with a CDEF, but is there a way to find the associated node as well?
Thanks,
Aaron
_______________________________________________
rrd-users mailing list
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
Loading...