Monitor the status of a port via snmp "ifOperStatus"

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

Post Reply
ukzerosniper
Cacti User
Posts: 118
Joined: Wed Oct 03, 2012 5:51 pm

Monitor the status of a port via snmp "ifOperStatus"

Post by ukzerosniper »

Hi Guys,

I have asked this question on the tail end of another thread which I fear may be dead, therefore I have decided to post a new thread with the question too.

I am trying to figure out how to monitor the status of links on our network. I have created a test map with only one link in it.

The idea as suggested in another post is to monitor the "ifOperStatus" of the ethernet port on the switches.

Currently, the best I can get is that it always says the link is down.

Below is the code I have used for the map and below that is an SNMP walk of the switch in question. The port im interested in on this example is port 4.

Thanks for any help anyone can provide.

Code: Select all

KEYPOS DEFAULT 1755 96 Traffic Load
KEYTEXTCOLOR 0 0 0
KEYOUTLINECOLOR 0 0 0
KEYBGCOLOR 255 255 255
BGCOLOR 255 255 255
TITLECOLOR 0 0 0
TIMECOLOR 0 0 0
SCALE DEFAULT 0 0 255 0 0 
SCALE DEFAULT 0 100 0 240 0 

SET key_hidezero_DEFAULT 1

# End of global section

# TEMPLATE-only NODEs:
NODE DEFAULT
	MAXVALUE 100

# TEMPLATE-only LINKs:
LINK DEFAULT
	BANDWIDTH 100M

# regular NODEs:
NODE mcswitch
	LABEL MC Switch
	ICON images/aaaSwitchSmall.png
	POSITION 191 198

NODE trswitch
	LABEL TR Switch
	ICON images/aaaSwitchSmall.png
	POSITION 547 198

# regular LINKs:
LINK mcswitch-trswitch
	SET ip 172.16.172.89
	SET interface 4
	TARGET snmp:{map:community}:{link:this:172.16.172.89}:.1.3.6.1.2.1.2.2.1.8{link:this:interface 4}:-
	NODES mcswitch trswitch

Code: Select all

+ Running data query [3].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at '/var/www/html/resource/snmp_queries/interface.xml'
+ XML file parsed ok.
+ Executing SNMP get for num of indexes @ '.1.3.6.1.2.1.2.1.0' Index Count: 10
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.2.1.2.2.1.1' Index Count: 10
+ Index found at OID: '1.3.6.1.2.1.2.2.1.1.1' value: '1'
+ Index found at OID: '1.3.6.1.2.1.2.2.1.1.2' value: '2'
+ Index found at OID: '1.3.6.1.2.1.2.2.1.1.3' value: '3'
+ Index found at OID: '1.3.6.1.2.1.2.2.1.1.4' value: '4'
+ Index found at OID: '1.3.6.1.2.1.2.2.1.1.5' value: '5'
+ Index found at OID: '1.3.6.1.2.1.2.2.1.1.6' value: '6'
+ Index found at OID: '1.3.6.1.2.1.2.2.1.1.7' value: '7'
+ Index found at OID: '1.3.6.1.2.1.2.2.1.1.8' value: '8'
+ Index found at OID: '1.3.6.1.2.1.2.2.1.1.9' value: '9'
+ Index found at OID: '1.3.6.1.2.1.2.2.1.1.10' value: '10'
+ Located input field 'ifIndex' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.1'
+ Found item [ifIndex='1'] index: 1 [from value]
+ Found item [ifIndex='2'] index: 2 [from value]
+ Found item [ifIndex='3'] index: 3 [from value]
+ Found item [ifIndex='4'] index: 4 [from value]
+ Found item [ifIndex='5'] index: 5 [from value]
+ Found item [ifIndex='6'] index: 6 [from value]
+ Found item [ifIndex='7'] index: 7 [from value]
+ Found item [ifIndex='8'] index: 8 [from value]
+ Found item [ifIndex='9'] index: 9 [from value]
+ Found item [ifIndex='10'] index: 10 [from value]
+ Located input field 'ifOperStatus' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.8'
+ Found item [ifOperStatus='Up'] index: 1 [from value]
+ Found item [ifOperStatus='Up'] index: 2 [from value]
+ Found item [ifOperStatus='Up'] index: 3 [from value]
+ Found item [ifOperStatus='Up'] index: 4 [from value]
+ Found item [ifOperStatus='Up'] index: 5 [from value]
+ Found item [ifOperStatus='Down'] index: 6 [from value]
+ Found item [ifOperStatus='Down'] index: 7 [from value]
+ Found item [ifOperStatus='Up'] index: 8 [from value]
+ Found item [ifOperStatus='Down'] index: 9 [from value]
+ Found item [ifOperStatus='Down'] index: 10 [from value]
+ Located input field 'ifDescr' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.2'
+ Found item [ifDescr='port 1: Gigabit Copper'] index: 1 [from value]
+ Found item [ifDescr='port 2: Gigabit Copper'] index: 2 [from value]
+ Found item [ifDescr='port 3: Gigabit Copper'] index: 3 [from value]
+ Found item [ifDescr='port 4: Gigabit Copper'] index: 4 [from value]
+ Found item [ifDescr='port 5: Gigabit Copper'] index: 5 [from value]
+ Found item [ifDescr='port 6: Gigabit Copper'] index: 6 [from value]
+ Found item [ifDescr='port 7: Gigabit Copper'] index: 7 [from value]
+ Found item [ifDescr='port 8: Gigabit Copper'] index: 8 [from value]
+ Found item [ifDescr='Fiber'] index: 9 [from value]
+ Found item [ifDescr='Fiber'] index: 10 [from value]
+ Located input field 'ifName' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.31.1.1.1.1'
+ Found item [ifName='port 1: Gigabit Copper'] index: 1 [from value]
+ Found item [ifName='port 2: Gigabit Copper'] index: 2 [from value]
+ Found item [ifName='port 3: Gigabit Copper'] index: 3 [from value]
+ Found item [ifName='port 4: Gigabit Copper'] index: 4 [from value]
+ Found item [ifName='port 5: Gigabit Copper'] index: 5 [from value]
+ Found item [ifName='port 6: Gigabit Copper'] index: 6 [from value]
+ Found item [ifName='port 7: Gigabit Copper'] index: 7 [from value]
+ Found item [ifName='port 8: Gigabit Copper'] index: 8 [from value]
+ Found item [ifName='port 9: Gigabit Copper'] index: 9 [from value]
+ Found item [ifName='port 10: Gigabit Copper'] index: 10 [from value]
+ Located input field 'ifAlias' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.31.1.1.1.18'
+ Found item [ifAlias=''] index: 1 [from value]
+ Found item [ifAlias=''] index: 2 [from value]
+ Found item [ifAlias=''] index: 3 [from value]
+ Found item [ifAlias=''] index: 4 [from value]
+ Found item [ifAlias=''] index: 5 [from value]
+ Found item [ifAlias=''] index: 6 [from value]
+ Found item [ifAlias=''] index: 7 [from value]
+ Found item [ifAlias=''] index: 8 [from value]
+ Found item [ifAlias=''] index: 9 [from value]
+ Found item [ifAlias=''] index: 10 [from value]
+ Located input field 'ifType' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.3'
+ Found item [ifType='ethernetCsmacd(6)'] index: 1 [from value]
+ Found item [ifType='ethernetCsmacd(6)'] index: 2 [from value]
+ Found item [ifType='ethernetCsmacd(6)'] index: 3 [from value]
+ Found item [ifType='ethernetCsmacd(6)'] index: 4 [from value]
+ Found item [ifType='ethernetCsmacd(6)'] index: 5 [from value]
+ Found item [ifType='ethernetCsmacd(6)'] index: 6 [from value]
+ Found item [ifType='ethernetCsmacd(6)'] index: 7 [from value]
+ Found item [ifType='ethernetCsmacd(6)'] index: 8 [from value]
+ Found item [ifType='ethernetCsmacd(6)'] index: 9 [from value]
+ Found item [ifType='ethernetCsmacd(6)'] index: 10 [from value]
+ Located input field 'ifSpeed' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.5'
+ Found item [ifSpeed='100000000'] index: 1 [from value]
+ Found item [ifSpeed='100000000'] index: 2 [from value]
+ Found item [ifSpeed='100000000'] index: 3 [from value]
+ Found item [ifSpeed='100000000'] index: 4 [from value]
+ Found item [ifSpeed='100000000'] index: 5 [from value]
+ Found item [ifSpeed='0'] index: 6 [from value]
+ Found item [ifSpeed='0'] index: 7 [from value]
+ Found item [ifSpeed='100000000'] index: 8 [from value]
+ Found item [ifSpeed='0'] index: 9 [from value]
+ Found item [ifSpeed='0'] index: 10 [from value]
+ Located input field 'ifHwAddr' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.6'
+ Found item [ifHwAddr='B0:48:7A:B3:27:57'] index: 1 [from value]
+ Found item [ifHwAddr='B0:48:7A:B3:27:57'] index: 2 [from value]
+ Found item [ifHwAddr='B0:48:7A:B3:27:57'] index: 3 [from value]
+ Found item [ifHwAddr='B0:48:7A:B3:27:57'] index: 4 [from value]
+ Found item [ifHwAddr='B0:48:7A:B3:27:57'] index: 5 [from value]
+ Found item [ifHwAddr='B0:48:7A:B3:27:57'] index: 6 [from value]
+ Found item [ifHwAddr='B0:48:7A:B3:27:57'] index: 7 [from value]
+ Found item [ifHwAddr='B0:48:7A:B3:27:57'] index: 8 [from value]
+ Found item [ifHwAddr='B0:48:7A:B3:27:57'] index: 9 [from value]
+ Found item [ifHwAddr='B0:48:7A:B3:27:57'] index: 10 [from value]
+ Located input field 'ifIP' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.4.20.1.2'
+ Found item [ifIP='0.0.0.0'] index: 2 [from regexp oid parse]
+ Found item [ifIP='127.0.0.1'] index: 1 [from regexp oid parse]
+ Found item [ifIP='172.16.172.89'] index: 2 [from regexp oid parse]
Pollay
Posts: 4
Joined: Mon Nov 04, 2013 10:16 am

Re: Monitor the status of a port via snmp "ifOperStatus"

Post by Pollay »

Looks like you've got a few things wrong in your TARGET line
TARGET snmp:{map:community}:{link:this:172.16.172.89}:.1.3.6.1.2.1.2.2.1.8{link:this:interface 4}:-
{map:community} - I don't see this defined anywhere. Just enter the community string here.
{link:this:172.16.172.89} - You don't have any variable 172.16.172.89 defined. You probably want to use {link:this:ip}
{link:this:interface 4} - No variable "interface 4" defined. Just use {link:this:interface}

So, your end result should be something like (assuming a community string of public)

Code: Select all

TARGET snmp:public:{link:this:ip}:.1.3.6.1.2.1.2.2.1.8.{link:this:interface}:-
edit: Typo, forgot about the missing . before {link:this:interface}. You were missing that as well :)
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests