Page 1 of 1

check_snmp fails in nagios when using MIB

Posted: Mon Aug 30, 2021 5:43 pm
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?

Re: check_snmp fails in nagios when using MIB

Posted: Tue Aug 31, 2021 11:30 am
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

Re: check_snmp fails in nagios when using MIB

Posted: Thu Sep 02, 2021 9:28 pm
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.

Re: check_snmp fails in nagios when using MIB

Posted: Thu Sep 09, 2021 11:22 am
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?