Count interfaces which are down

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

Post Reply
madsn
Cacti User
Posts: 50
Joined: Tue Oct 13, 2009 6:26 am

Count interfaces which are down

Post by madsn »

I have created serveral weathermaps that show our network setup.

Now I would like to create an overview site or map, which should be the main site for the network with all key numbers included.

Especially I would like to calculate the number of interfaces that are currently down. How can I do this? Currently I'm using the templates given in this http://forums.cacti.net/about17722.html topic to show the interface status.

If it is not possible to create a seperate site with the info, I would like to add it in each seperate map. Any suggestions?
madsn
Cacti User
Posts: 50
Joined: Tue Oct 13, 2009 6:26 am

Post by madsn »

Ok just want to show what I have come up with so far, maybe this could lead someone to help me a bit further :-)

Code: Select all

NODE TEST_NODE
  SET number_of_interfaces 2
  LABEL Offline interfaces {node:this:bandwidth_in:%d}
  POSITION 50 400
  TARGET number_of_interfaces-gauge:/var/www/html/cacti/rra/hr2-de-offs-sr1_de-prod_dk_int_status_91.rrd:int_status:-  gauge:/var/www/html/cacti/rra/hr2-de-offs-sr1_de-prod_dk_int_status_92.rrd:int_status:-
This is not working for me is this possible at all to do it in this way?
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

'2' is not a valid target.

'static:2' is though. The first minus sign (not the DS names) needs to be a prefix on a target too, not like it is with no spaces:

TARGET static:2 -gauge:blah... -gauge:bleh...

The only problem I can see is that with standard SNMP interface status, 1 is up and 2 is down, so the math is a bit funny.
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!)
madsn
Cacti User
Posts: 50
Joined: Tue Oct 13, 2009 6:26 am

Post by madsn »

Hi Howie

Thanks that was exactly what I needed :-) Just want to explain how I solved the issue with 1 for down and 2 for up.

My Node is now looking like this:

Code: Select all

NODE TEST_NODE
	LABEL TEST SUM {node:this:bandwidth_in:%d}
	POSITION 50 400
	TARGET static:6 -gauge:/var/www/html/cacti/rra/hr2-de-offs-sr1_de-prod_dk_int_status_91.rrd:int_status:-  -gauge:/var/www/html/cacti/rra/hr2-de-offs-sr1_de-prod_dk_int_status_92.rrd:int_status:- -gauge:/var/www/html/cacti/rra/hr2-de-offs-sr1_de-prod_dk_int_status_93.rrd:int_status:-
In my example I use static:6 which is twice the number of interfaces that I want to use in my sum. In the table below I have shown all combinations of the 3 interfaces u=up and d=down. For each case the calculation results in the number of interfaces which are down.

Code: Select all

1   2   3
u   u   u =>static:6 -gauge:blah -gauge:blah -gauge:blah = 6 -2 -2 -2 = 6-6 =0
u   u   d =>6-5 =1
u   d   d =>6-4 =2
d   d   d =>6-3 =3
madsn
Cacti User
Posts: 50
Joined: Tue Oct 13, 2009 6:26 am

Post by madsn »

New problem :-(

The TARGET in my node has now become so long that, weathermap is not able to read it (I'm monitoring 92 interfaces). So what I did instead was to create two hidden nodes each with half the number of entrys in the TARGET. Now I want to use the result of these two TARGETs in a third node where the final calculation is done. My problem is taht I don't know how to refere to the TARGETs in the two hidden nodes and whether this is possible at all.

Code: Select all

NODE HIDDEN_1
   TARGET -gauge:{map:path_rra}/blah.rrd -gauge:{map:path_rra}/blah.rrd -gauge:{map:path_rra}/blah.rrd ........
  POSITION 10000 10000

NODE HIDDEN_2
   TARGET -gauge:{map:path_rra}/blah.rrd -gauge:{map:path_rra}/blah.rrd -gauge:{map:path_rra}/blah.rrd .......
  POSITION 10000 10000

NODE SUM_OF_INTERFACES
   LABEL SUM {node:this:bandwidth_in:%d}
   TARGET static:184 {node:HIDDEN_1:what_should_I_write_here} {node:HIDDEN_2:what_should_I_write_here} 
  POSITION 10000 10000

User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

madsn wrote:New problem :-(

The TARGET in my node has now become so long that, weathermap is not able to read it (I'm monitoring 92 interfaces). So what I did instead was to create two hidden nodes each with half the number of entrys in the TARGET. Now I want to use the result of these two TARGETs in a third node where the final calculation is done. My problem is taht I don't know how to refere to the TARGETs in the two hidden nodes and whether this is possible at all.
It's not possible. If you think about the worst case, you can have circular references once you start allowing this. The tokens in the TARGET line are evaluated once only, just before the data is read.

What you can do is increase the length of line that Weathermap will read though - I didn't even think it would ever be a problem! :-) In 0.97, you do this by changing the fgets call around line 2100 - increase the 4096 to 10000 or whatever - that's the number of characters.
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!)
madsn
Cacti User
Posts: 50
Joined: Tue Oct 13, 2009 6:26 am

Post by madsn »

Thanks the increase in fget solved the problem, it works perfect now!
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

Just tidying up loose ends - I've increased the default to 16384 for the next release.
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!)
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests