Page 1 of 1

snmp_check not working with text OID after CPAN installation

Posted: Tue Feb 22, 2022 6:26 am
by mlazzarotto
Hi, yesterday I was adding some firewalls on my Nagios.
I added successfully a SonicWall SMA virtual appliance using several SNMP checks, and that was working fine until yesterday at around 10:45.
Note that I copied related MIBs to /usr/share/snmp/mib folder.

My linux history shows that at that time I executed the command CPAN. I had to use CPAN to install Nagios::Plugin but it failed, then I tried Monitoring::Plugin and it failed as well. Lastly, I did yum install perl-Nagios-Plugin (removed today to try to solve my problem).
This was needed to check a Cisco ASR router.

Today I checked Nagios and turns out that all the checks returns
CRITICAL - Plugin timed out while executing system call

My snmp_check command:

Code: Select all

define command{
        command_name    check_snmp
        command_line    $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
        }
and this is one of the checks for that SMA appliance

Code: Select all

define service{
        use                 	generic-service
        host_name              	<redacted>
        service_description    	Uptime
        check_command          	check_snmp!-C ReAD_oNly -o sysUpTime.0
}
if I manually execute the command, this shows:

Code: Select all

[root@server ~]# /usr/local/nagios/libexec/check_snmp -H 10.1.1.235 -C ReAD_oNly -o sysUpTime.0  -v
/usr/bin/snmpget -Le -t 3 -r 5 -m ALL -v 1 [context] [authpriv] 10.1.1.235:161 sysUpTime.0
CRITICAL - Plugin timed out while executing system call
but when I use the numeric OID instead, it works fine

Code: Select all

[root@server ~]# /usr/local/nagios/libexec/check_snmp -H 10.1.1.235 -C ReAD_oNly -o .1.3.6.1.4.1.8741.6.2.1.7.0  -v
/usr/bin/snmpget -Le -t 3 -r 5 -m '' -v 1 [context] [authpriv] 10.1.1.235:161 .1.3.6.1.4.1.8741.6.2.1.7.0
iso.3.6.1.4.1.8741.6.2.1.7.0 = STRING: "62 Days 04:03:50"
SNMP OK - "62 Days 04:03:50" |
check_snmp v2.3.3 (nagios-plugins 2.3.3)

Re: snmp_check not working with text OID after CPAN installa

Posted: Tue Feb 22, 2022 1:39 pm
by gormank
Maybe try check_snmp --verbose or -v to see if that tells you more. All I can think of is that the MIB can't be read by the nagios user. I don't see how the other things can impact testing from the shell.

Re: snmp_check not working with text OID after CPAN installa

Posted: Wed Feb 23, 2022 11:48 am
by mlazzarotto
gormank wrote:Maybe try check_snmp --verbose or -v to see if that tells you more. All I can think of is that the MIB can't be read by the nagios user. I don't see how the other things can impact testing from the shell.
As you can see the in the fourth code block I'm already using check_snmp with -v option

Re: snmp_check not working with text OID after CPAN installa

Posted: Wed Feb 23, 2022 1:26 pm
by gormank
Maybe try setting -m SNMPv2-MIB.mib in the command, and make sure SNMPv2-MIB.mib is in the mibs dir?

-m, --miblist=STRING
List of MIBS to be loaded (default = none if using numeric OIDs or 'ALL'
for symbolic OIDs.)

Re: snmp_check not working with text OID after CPAN installa

Posted: Fri Feb 25, 2022 5:52 am
by mlazzarotto
gormank wrote:Maybe try setting -m SNMPv2-MIB.mib in the command, and make sure SNMPv2-MIB.mib is in the mibs dir?

-m, --miblist=STRING
List of MIBS to be loaded (default = none if using numeric OIDs or 'ALL'
for symbolic OIDs.)
Hey! Thank you sir! Specifying SNMPv2-MIB.txt did the trick (I'm curious why, though).