snmp_check not working with text OID after CPAN installation

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.
Locked
mlazzarotto
Posts: 5
Joined: Wed Apr 28, 2021 4:00 am

snmp_check not working with text OID after CPAN installation

Post 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)
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: snmp_check not working with text OID after CPAN installa

Post 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.
mlazzarotto
Posts: 5
Joined: Wed Apr 28, 2021 4:00 am

Re: snmp_check not working with text OID after CPAN installa

Post 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
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: snmp_check not working with text OID after CPAN installa

Post 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.)
mlazzarotto
Posts: 5
Joined: Wed Apr 28, 2021 4:00 am

Re: snmp_check not working with text OID after CPAN installa

Post 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).
Locked