SNMP chcek of Cisco 3750 switch

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: SNMP chcek of Cisco 3750 switch

Post by scottwilkerson »

So again this may be a problem MIB, lets move it too
mv /usr/share/mibs/ietf/IPATM-IPMC-MIB /tmp

Then the ./check_snmp_cisco.p is trying to cache data in a directory which doesn't exist so you would need to create it

Code: Select all

mkdir -p /var/nagios_plugin_cache
chown nagios:nagios /var/nagios_plugin_cache
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: SNMP chcek of Cisco 3750 switch

Post by kwhogster »

Scott

root@tgcs017:/usr/local/nagios/libexec# mv /usr/share/mibs/ietf/IPATM-IPMC-MIB /tmp DONE

root@tgcs017:/usr/local/nagios/libexec# mkdir -p /var/nagios_plugin_cache DONE
root@tgcs017:/usr/local/nagios/libexec# chown nagios:nagios /var/nagios_plugin_cache DONE


root@tgcs017:/usr/local/nagios/libexec# ./check_snmp_cisco.pl -H 10.2.8.4 -C public -I GigabitEthernet1/1/21
Bad operator (INTEGER): At line 73 in /usr/share/mibs/ietf/SNMPv2-PDU
Bad operator (INTEGER): At line 73 in /usr/share/mibs/ietf/SNMPv2-PDU
Bad operator (INTEGER): At line 73 in /usr/share/mibs/ietf/SNMPv2-PDU
IF-MIB::ifOperStatus.: Unknown Object Identifier (Index out of range: (ifIndex))
Unknown state for GigabitEthernet1/1/21 : check your -s state syntax


Add the -S up
root@tgcs017:/usr/local/nagios/libexec# ./check_snmp_cisco.pl -H 10.2.8.4 -C public -I GigabitEthernet1/1/21 -S up
Bad operator (INTEGER): At line 73 in /usr/share/mibs/ietf/SNMPv2-PDU
IF-MIB::ifOperStatus.: Unknown Object Identifier (Index out of range: (ifIndex))
Unknown state for GigabitEthernet1/1/21 : check your -s state syntax



The other check does this now

root@tgcs017:/usr/local/nagios/libexec# ./check_snmp_cisco.sh -H 10.2.8.4 -C public -i GigabitEthernet1/1/21
Bad operator (INTEGER): At line 73 in /usr/share/mibs/ietf/SNMPv2-PDU
Can not get Interface Status of port


This is the original check I was trying it shows this now

root@tgcs017:/usr/local/nagios/libexec# ./check_cisco.pl -h 10.2.8.4 -c public -i GigabitEthernet1/1/21 -s down
Bad operator (INTEGER): At line 73 in /usr/share/mibs/ietf/SNMPv2-PDU
Bad operator (INTEGER): At line 73 in /usr/share/mibs/ietf/SNMPv2-PDU
Interface not found : please check your syntax for this device


getting closer ?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: SNMP chcek of Cisco 3750 switch

Post by scottwilkerson »

let's move the last item erroring

Code: Select all

mv /usr/share/mibs/ietf/SNMPv2-PDU /tmp
Lets run this (you had a capital S last time)

Code: Select all

./check_snmp_cisco.pl -H 10.2.8.4 -C public -I GigabitEthernet1/1/21 -s up
Also you may need to put the interface in quotes

Code: Select all

./check_snmp_cisco.pl -H 10.2.8.4 -C public -I 'GigabitEthernet1/1/21' -s up
Finally, can you show me the help for the plugin as I do not have it to look at

Code: Select all

./check_snmp_cisco.pl -h
also, if it is this it looks like the interface flag is -i NOT -I

sooooo

Code: Select all

./check_snmp_cisco.pl -H 10.2.8.4 -C public -i 'GigabitEthernet1/1/21' -s up
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: SNMP chcek of Cisco 3750 switch

Post by kwhogster »

root@tgcs017:/usr/local/nagios/libexec# mv /usr/share/mibs/ietf/SNMPv2-PDU /tmp DONE

root@tgcs017:/usr/local/nagios/libexec# ./check_snmp_cisco.pl -H 10.2.8.4 -C public -I 'GigabitEthernet1/1/21' -s up
Unknown option: s
IF-MIB::ifOperStatus.: Unknown Object Identifier (Index out of range: (ifIndex))
Unknown state for GigabitEthernet1/1/21 : check your -s state syntax

root@tgcs017:/usr/local/nagios/libexec# ./check_snmp_cisco.pl -H 10.2.8.4 -C public -I 'GigabitEthernet1/1/21' -S up
IF-MIB::ifOperStatus.: Unknown Object Identifier (Index out of range: (ifIndex))
Unknown state for GigabitEthernet1/1/21 : check your -s state syntax
root@tgcs017:/usr/local/nagios/libexec# ./check_snmp_cisco.pl -h

Hostname/address not specified


Usage: check_cisco_snmp -H ip -C community -I interface -S state (optional)

or

Usage: check_cisco_snmp -h for help.

root@tgcs017:/usr/local/nagios/libexec# ./check_snmp_cisco.pl -H 10.2.8.4 -C public -i 'GigabitEthernet1/1/21' -s up
Unknown option: i
Unknown option: s

Interface not specified


Usage: check_cisco_snmp -H ip -C community -I interface -S state (optional)

or

Usage: check_cisco_snmp -h for help.
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: SNMP chcek of Cisco 3750 switch

Post by kwhogster »

Scott

this is the other check

root@tgcs017:/usr/local/nagios/libexec# ./check_snmp_cisco.sh -H 10.2.8.4 -C public -i GigabitEthernet1/1/21
Can not get Interface Status of port
root@tgcs017:/usr/local/nagios/libexec# ./check_snmp_cisco.sh -H 10.2.8.4 -C public -i 'GigabitEthernet1/1/21'
Can not get Interface Status of port
root@tgcs017:/usr/local/nagios/libexec# ./check_snmp_cisco.sh -h
check_snmp_cisco.sh version 1.0

The nagios plugins come with ABSOLUTELY NO WARRANTY.
You may redistribute copies of the plugins under the terms of the GNU General Public License v2.

Usage: ./check_snmp_cisco -H 10.60.100.1 -C public -i Fa0/15 -w unknown -c down
check_snmp_cisco.sh -H ADDRESS
check_snmp_cisco.sh -C STRING
check_snmp_cisco.sh -i INTERFACE
check_snmp_cisco.sh -w INTEGER
check_snmp_cisco.sh -c INTEGER
check_snmp_cisco.sh -h
check_snmp_cisco.sh -V

Check the consummable of the printer

-H ADDRESS
Name or IP address of host (default: 127.0.0.1)
-C STRING
Community name for the host's SNMP agent (default: public)
-i INTERFACE
Interface to check: Fa0/15
-w INTEGER
Warning level for consummable in percent (default: down)
-c INTEGER
Critical level for consummable in percent (default: unknown)
-h
Print this help screen
-V
Print version and license information


This plugin uses the 'snmpget' command and 'snmpwalk' command included with the NET-SNMP package.
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: SNMP chcek of Cisco 3750 switch

Post by kwhogster »

Scott

This is the original check

root@tgcs017:/usr/local/nagios/libexec# ./check_cisco.pl -h 10.2.8.4 -c public -i GigabitEthernet1/1/21 -s down
Interface not found : please check your syntax for this device
root@tgcs017:/usr/local/nagios/libexec# ./check_cisco.pl -h 10.2.8.4 -c public -i "GigabitEthernet1/1/21" -s down
Interface not found : please check your syntax for this device
root@tgcs017:/usr/local/nagios/libexec# ./check_cisco.pl -h 10.2.8.4 -c public -i 'GigabitEthernet1/1/21' -s down
Interface not found : please check your syntax for this device
root@tgcs017:/usr/local/nagios/libexec#
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: SNMP chcek of Cisco 3750 switch

Post by scottwilkerson »

earlier when you listed the ports, you did not have a port GigabitEthernet1/1/21 but did have a GigabitEthernet1/0/21

Code: Select all

iso.3.6.1.2.1.2.2.1.2.10150 = STRING: "GigabitEthernet1/1/2"
iso.3.6.1.2.1.2.2.1.2.10151 = STRING: "GigabitEthernet1/1/3"
iso.3.6.1.2.1.2.2.1.2.10152 = STRING: "GigabitEthernet1/1/4"
iso.3.6.1.2.1.2.2.1.2.10201 = STRING: "TenGigabitEthernet1/1/1"
Can you run it with that?

Code: Select all

./check_cisco.pl -h 10.2.8.4 -c public -i GigabitEthernet1/0/21 -s down
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: SNMP chcek of Cisco 3750 switch

Post by kwhogster »

Scott
Good catch event with glasses on I missed that LOL

root@tgcs017:/usr/local/nagios/libexec# ./check_cisco.pl -h 10.2.8.4 -c public -i GigabitEthernet1/0/21 -s down
GigabitEthernet1/0/21 should not be up
root@tgcs017:/usr/local/nagios/libexec# ./check_cisco.pl -h 10.2.8.4 -c public -i GigabitEthernet1/0/21 -s up
GigabitEthernet1/0/21 up: , LastChanges: (49480) 0:08:14.80, Traffic in : 2600355167 octets, out: 1999632072 octets

Looks like it is working now will add to the Nagios config and see what happens

Thank for all the help
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: SNMP chcek of Cisco 3750 switch

Post by scottwilkerson »

kwhogster wrote:Scott
Good catch event with glasses on I missed that LOL

root@tgcs017:/usr/local/nagios/libexec# ./check_cisco.pl -h 10.2.8.4 -c public -i GigabitEthernet1/0/21 -s down
GigabitEthernet1/0/21 should not be up
root@tgcs017:/usr/local/nagios/libexec# ./check_cisco.pl -h 10.2.8.4 -c public -i GigabitEthernet1/0/21 -s up
GigabitEthernet1/0/21 up: , LastChanges: (49480) 0:08:14.80, Traffic in : 2600355167 octets, out: 1999632072 octets

Looks like it is working now will add to the Nagios config and see what happens

Thank for all the help
great! Glad I could help!
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: SNMP chcek of Cisco 3750 switch

Post by kwhogster »

Scott.

Have all the interfaces setup now and all working fine.

This can now be locked as resolved.

Thanks again for all the help :D
Locked