Page 2 of 3

Re: SNMP chcek of Cisco 3750 switch

Posted: Tue Nov 27, 2018 1:01 pm
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

Re: SNMP chcek of Cisco 3750 switch

Posted: Tue Nov 27, 2018 1:43 pm
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 ?

Re: SNMP chcek of Cisco 3750 switch

Posted: Tue Nov 27, 2018 1:59 pm
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

Re: SNMP chcek of Cisco 3750 switch

Posted: Tue Nov 27, 2018 2:06 pm
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.

Re: SNMP chcek of Cisco 3750 switch

Posted: Tue Nov 27, 2018 2:08 pm
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.

Re: SNMP chcek of Cisco 3750 switch

Posted: Tue Nov 27, 2018 2:10 pm
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#

Re: SNMP chcek of Cisco 3750 switch

Posted: Tue Nov 27, 2018 2:25 pm
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

Re: SNMP chcek of Cisco 3750 switch

Posted: Tue Nov 27, 2018 2:38 pm
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

Re: SNMP chcek of Cisco 3750 switch

Posted: Tue Nov 27, 2018 3:53 pm
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!

Re: SNMP chcek of Cisco 3750 switch

Posted: Tue Nov 27, 2018 4:01 pm
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