My check_snmp command doesn´t work for switch monitoring

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.
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

My check_snmp command doesn´t work for switch monitoring

Post by Jessuzz94 »

Hi, i have used nagios 4 for 1 month approximately and i have done test and it works, but i have one problem with one cisco switch, it doesnt send me the UPTIME via snmp, in the nagios web interface the Upime service shows:

CRITICAL - Plugin timed out while executing system call

I have check_snmp in /usr/local/nagioslibexec

this is my configuration in nagios

in the switch.cfg:


define service{
use generic-service
host_name switchcisco
service_description Uptime
check_command check_snmp!-C public -o sysUpTime.0
}

in commands.cfg

define command{
command_name check_snmp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
}




in my cisco switch i put the command "snmp-server community public ro" to enable the snmp in the switch

so, whats wrong with the service monitoring?, I hope that you can help me :c
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: My check_snmp command doesn´t work for switch monitoring

Post by jdalrymple »

Let's start by testing from the command line:

Code: Select all

snmpget -v 2c -c public <ciscoIP> sysUpTime.0
If that doesn't work lets try:

Code: Select all

snmpget -v 2c -c public <ciscoIP> .1.3.6.1.2.1.1.3.0
For the record, at initial glance your command and service definitions look OK.
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: My check_snmp command doesn´t work for switch monitoring

Post by Jessuzz94 »

The command "snmpget -v 2c -c public <ciscoIP> sysUpTime.0" throws me:

sysUptime.0: Unknown Object Identifier (Sub-id not found: (top) -> sysUptime)

what means?

the seccond command "snmpget -v 2c -c public <ciscoIP> .1.3.6.1.2.1.1.3.0" throws me:

iso.3.6.1.2.1.1.3.0 = Timeticks: (530168) 1:28:21.68


Do i need to install something that i mising?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: My check_snmp command doesn´t work for switch monitoring

Post by tgriep »

Could you run the following and upload the /tmp/walk.txt file?

Code: Select all

snmpwalk  -v 2c <CiscoIP> -c public >/tmp/walk.txt
Be sure to check out our Knowledgebase for helpful articles and solutions!
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: My check_snmp command doesn´t work for switch monitoring

Post by Jessuzz94 »

i opened the /tmp/walk.txt and shows me a lot of lines of iso.3.6.1.2.1.2.2.1.x= INTEGER 1....2...3....

but in the beginning the information of my switch,

STRING "Cisco Internetwork Operating System Software
IQS/tm) .... ..... ....
STRING "testcontact"
STRING"NameofTheSwitch"
.......
......
iso 3.6..2.1.2.2.1.2.1 = STRING: "VLAN1"
iso 3.6..2.1.2.2.1.2.2 = STRING: "FastEthernet0/1"
iso 3.6..2.1.2.2.1.2.3 = STRING: "FastEthernet0/2"
iso 3.6..2.1.2.2.1.2.4 = STRING: "FastEthernet0/3"

thinks like that
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: My check_snmp command doesn´t work for switch monitoring

Post by tgriep »

Check the file for this string

Code: Select all

sysUpTime
Be sure to check out our Knowledgebase for helpful articles and solutions!
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: My check_snmp command doesn´t work for switch monitoring

Post by Jessuzz94 »

what is this, a command? a line in walk.txt? be more specific please :c
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: My check_snmp command doesn´t work for switch monitoring

Post by jdalrymple »

Grab a copy of SNMPv2-MIB from somewhere (just google it, you'll find it) and place it in /usr/share/snmp/mibs then try your

Code: Select all

snmpget -v 2c -c public <ciscoIP> sysUpTime.0
command again.

If it fails

Code: Select all

snmptranslate -Dinit_mib .1.3 2>&1 | grep MIBDIR
Move that MIB to one of the directories it spits out at you.

I don't think this is going to resolve your problem just yet, but it's gotta work before we move on to further troubleshoot.
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: My check_snmp command doesn´t work for switch monitoring

Post by Jessuzz94 »

the SNMPv-MIB that i download is in .my and the mibs of the directory /usr/share/snmp/mibs ends in .txt
do i need to change the .my for .txt or doesnt matter?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: My check_snmp command doesn´t work for switch monitoring

Post by jdalrymple »

The name of the file is entirely irrelevant, as long as it's a valid copy of the MIB
Locked