Page 1 of 5
My check_snmp command doesn´t work for switch monitoring
Posted: Thu Jun 04, 2015 12:40 pm
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
Re: My check_snmp command doesn´t work for switch monitoring
Posted: Thu Jun 04, 2015 12:50 pm
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.
Re: My check_snmp command doesn´t work for switch monitoring
Posted: Thu Jun 04, 2015 12:58 pm
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?
Re: My check_snmp command doesn´t work for switch monitoring
Posted: Thu Jun 04, 2015 1:29 pm
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
Re: My check_snmp command doesn´t work for switch monitoring
Posted: Thu Jun 04, 2015 1:53 pm
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
Re: My check_snmp command doesn´t work for switch monitoring
Posted: Thu Jun 04, 2015 1:56 pm
by tgriep
Check the file for this string
Re: My check_snmp command doesn´t work for switch monitoring
Posted: Thu Jun 04, 2015 1:59 pm
by Jessuzz94
what is this, a command? a line in walk.txt? be more specific please :c
Re: My check_snmp command doesn´t work for switch monitoring
Posted: Thu Jun 04, 2015 2:21 pm
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.
Re: My check_snmp command doesn´t work for switch monitoring
Posted: Thu Jun 04, 2015 2:41 pm
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?
Re: My check_snmp command doesn´t work for switch monitoring
Posted: Thu Jun 04, 2015 3:05 pm
by jdalrymple
The name of the file is entirely irrelevant, as long as it's a valid copy of the MIB