Check_snmp nagios plugin issue after upgrade to 2.4.0p16

CMK version: 2.4.0p16.cre
OS version: Debian 13

Error message:

External command error: /usr/bin/snmpget: symbol lookup error: /usr/bin/snmpget: undefined symbol: netsnmp_cleanup_session

Description:

/usr/lib/nagios/plugins/check_snmp command from monitoring-plugins-standard package was configured using “Setup > Services > Other services > Integrate Nagios plug-ins” rules. Check was running fine until upgrade do Debian13 and 2.4.0p16 (first build compatible with this OS).

The command line is (an example, we have much more like this):

/usr/lib/nagios/plugins/check_snmp -H $HOSTADDRESS$ -P 3 -L authPriv -U 'user' -a SHA256 -A <secret> -x AES -X <secret> -o .1.3.6.1.4.1.12356.101.12.2.2.1.20.3.1 -c @1:1

After upgrade all checks get UNKN with provided above error message.

Causes:

Site user uses libraries shipped with checkmk package instead of OS shipped libraries:

OMD[xyz]:~$ ldd /usr/bin/snmpget
	(...)
	libnetsnmp.so.40 => /omd/sites/xyz/lib/libnetsnmp.so.40 (0x00007f7a5bab9000)
	(...)

(root)# ldd /usr/bin/snmpget
	(...)
	libnetsnmp.so.40 => /lib/x86_64-linux-gnu/libnetsnmp.so.40 (0x00007f7fd46a3000)
	(...)

Running check_snmp as root does not produce any error (SNMP OK), while running as site user does.

Workaround:

I renamed /usr/lib/nagios/plugins/check_snmp to check_snmp.bin and created check_snmp wrapper script as follows:

#!/bin/bash
unset LD_LIBRARY_PATH
exec /usr/lib/nagios/plugins/check_snmp.bin "$@"

Which solved the problem for now (until monitoring-plugins-standard package get updated).

Final note:

In my opinion this is a bug in shipped /omd/sites/itw/lib/libnetsnmp.so.40

I created this post to let you all know about this issue and workaround.

I’ve already upgraded to 2.4.0p17.cre and this didn’t solve the issue.

You should use $OMD_ROOT/lib/nagios/plugins/check_snmp.

1 Like

After that change I get

External command error: snmpget: Unknown host ($:161)

Maybe checkmk’s check_snmp have different parameters :thinking: I’ll check it and come back later.

Service works as expected for exact two set of commands:

  1. $OMD_ROOT/lib/nagios/plugins/check_snmp -H 1.2.3.4 (...) - OMD_ROOT + hardcoded IP
  2. /omd/sites/xyz/lib/nagios/plugins/check_snmp -H $HOSTADDRESS$ (…) - full path + IP from variable

All other combinations of $OMD_ROOT, $HOSTADDRESS$, $HOSTADDRESS_4$ fail with different errors.

I think this is related to “$” sign and variables processing order, however I do not know how to troubleshoot it further. I’ve also tried to replace $OMD_ROOT with $OMD_ROOT$ but it just changed the error message.

I guess we will implement no.2 because we have single instance with one site only, thus it will generate less work.

You can omit $OMD_ROOT/lib/nagios/plugins in the command line of that ruleset. It will automatically find the Nagios plugin.

Have a look at the inline help.

1 Like