check_snmp fails in nagios when using MIB

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
wastedcosmonaut
Posts: 2
Joined: Mon Aug 30, 2021 5:35 pm

check_snmp fails in nagios when using MIB

Post by wastedcosmonaut »

Running check_snmp manually, the following succeeds:
/usr/lib64/nagios/plugins/check_snmp -o tlpUpsOutputSource.1 -H UPShostname.com -m $USER1$/TRIPPLITE-PRODUCTS.MIB -R '3|9' -vvv

Code: Select all

/usr/bin/snmpget -Le -t 3 -r 5 -m /root/.snmp/TRIPPLITE-PRODUCTS.MIB -v 1 [context] [authpriv] UPShostname.com:161 tlpUpsOutputSource.1
TRIPPLITE-PRODUCTS::tlpUpsOutputSource.1 = INTEGER: economy(9)
Processing oid 1 (line 1)
  oidname: TRIPPLITE-PRODUCTS::tlpUpsOutputSource.1
  response: INTEGER: economy(9)
SNMP OK - economy(9) |
Crits when supposed to, OKs when supposed to (Status 3 or 9)

But when added as a check_command in Nagios Core 4.4, it fails. "critical - plugin timed out while executing system call"

If I remove the mib and use the oid instead of the name, it works. But this doesn't provide the labels. (Normal, bypass, etc)

Any idea why?
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: check_snmp fails in nagios when using MIB

Post by gormank »

I'd guess Nagios can't access root's home dir so the check fails using the MIB.
/usr/bin/snmpget -Le -t 3 -r 5 -m /root/.snmp/TRIPPLITE-PRODUCTS.MIB
wastedcosmonaut
Posts: 2
Joined: Mon Aug 30, 2021 5:35 pm

Re: check_snmp fails in nagios when using MIB

Post by wastedcosmonaut »

gormank wrote:I'd guess Nagios can't access root's home dir so the check fails using the MIB.
/usr/bin/snmpget -Le -t 3 -r 5 -m /root/.snmp/TRIPPLITE-PRODUCTS.MIB
When Nagios runs the command, it did error with "No permission to access file" or something. I moved the MIB into $USER1$ and adjusted the command, which lead to this error. Nagios does have permission for where the file is now. So that's not the problem, as far as I can tell.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: check_snmp fails in nagios when using MIB

Post by gormank »

I think the MIB dir is /usr/share/snmp/mibs/.
Can you post the command and output when run as the nagios user, and the contents of the service .cfg file?
Locked