Division math operation using phpweathermap

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

Post Reply
rvalverde
Posts: 4
Joined: Mon Jul 27, 2015 11:03 am

Division math operation using phpweathermap

Post by rvalverde »

Hi Howie.

First of all, congratulations for developing phpweathermap. We have been using it since 2008 and we are very satisfied with this fabulous and powerful tool.

Recently, we have decided to monitor error and discard rates of our critical routers and switches. Our datasource are RRD files and they are generated by NMIS, another management tool.

The problem I´m facing is how to divide using phpweathermap and I will explain why I need it. Below you can observe the way NMIS store and calculate some metrics:

'ifOutPkts = ifOutUcastPkts,ifOutMcastPkts,ifOutBcastPkts,ifOutDiscards,ifOutErrors,+,+,+,+',

NMIS considers ifOutPkts (total ouput packets) as a sum of these 5 SNMP variables. So, I collected the 5 values using the "IN" Target variable of phpweathermap and the ifOutErrors using the "OUT" one:

TARGET
gauge:/var/nmisdb/interface/router/router-wan2/router-wan2-gigabitethernet0-0-pkts_hc.rrd:ifOutUcastPkts:-
gauge:/var/nmisdb/interface/router/router-wan2/router-wan2-gigabitethernet0-0-pkts_hc.rrd:ifOutMcastPkts:
gauge:/var/nmisdb/interface/router/router-wan2/router-wan2-gigabitethernet0-0-pkts_hc.rrd:ifOutBcastPkts:-
gauge:/var/nmisdb/interface/router/router-wan2/router-wan2-gigabitethernet0-0-pkts_hc.rrd:ifOutDiscards:- - gauge:/var/nmisdb/interface/router/router-wan2/router-wan2-gigabitethernet0-0-pkts_hc.rrd:ifOutErrors:-

gauge:/var/nmisdb/interface/router/router-wan2/router-wan2-gigabitethernet0-0-pkts_hc.rrd:-:ifOutErrors


In order to show the error/discard percantage in a label, I was searching a way to divide in phpweathermap (ifOutErrors/ifOutPkts), but I didn´t find. Could you help me?
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Division math operation using phpweathermap

Post by Howie »

There isn't a divide (or multiply) for targets. One of the wishlist features is to replace the current target syntax with real math expressions. It's not high on the list.

An alternate approach would be to allow a variable in the BANDWIDTH line, so you could use ifSpeed or ifOutPkts. That has other uses, but is also not a high priority. I prefer option 1. What do you think?

Personally I just alert on ifOutErrors > 0 (or some low error rate), rather than as a percentage of the traffic, but our network is mostly ethernet not WAN or wireless.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
rvalverde
Posts: 4
Joined: Mon Jul 27, 2015 11:03 am

Re: Division math operation using phpweathermap

Post by rvalverde »

Hi Howie. Thanks for your reply.
Regarding using a variable in the BANDWIDTH line, it sounds good and I remember I had tested it but it didn't work. I also tried unsuccessfully to use a variable in MAXVALUE line inside the node. I don't know if I'm doing something wrong. In theory, it should be an additional line with BANDWIDTH ifOutPkts (for links) or with MAXVALUE ifOutPkts (for nodes), isn't it?

Regards,
Ricardo - Brasília/Brazil
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Division math operation using phpweathermap

Post by Howie »

It isn't supported - that's why it doesn't work!

It makes things complicated with validating the configuration too - at the moment, you would get an error as soon as you tried to put something incorrect in a MAXVALUE/BANDWIDTH line. With this, it would mean that error would happen after all the data had been collected for the map, because you don't know the contents of MAXVALUE until then, and it might not be a number (the variables can contain text too).

So I have avoided doing this until now.

I think the "proper maths" option is better, because it is more flexible.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
rvalverde
Posts: 4
Joined: Mon Jul 27, 2015 11:03 am

Re: Division math operation using phpweathermap

Post by rvalverde »

Thanks, Howie. Now I could understand the logic of phpweathermap. So, I will wait for some news in math operations. :D
Meanwhile, I will use absolute values of ifOutErrors SNMP variable.

Regards,
Ricardo
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests