ltb-project / nagios-plugins

Plugins for Nagios
GNU General Public License v3.0
8 stars 8 forks source link

check_ldap_monitor.pl give errors in perl 5.20 on debian strech #7

Closed bilbo-the-hobbit closed 5 years ago

bilbo-the-hobbit commented 5 years ago

Hello,

when running the check_ldap_monitor on stretch with the following parameters i got perl errors.

check_ldap_monitor.pl -H ldap://localhost -D "cn=monitoring,cn=monitor" -b cn=monitor -P tester -T currentconnections -m greater -w 10 -c 15 -f -vvv
VERBOSE 3 ===> Enter &get_ldapconn
VERBOSE 2 ===> Connected to ldap://localhost
VERBOSE 2 ===> Bind with cn=monitoring,cn=monitor
VERBOSE 3 ===> Leave &get_ldapconn
VERBOSE 3 ===> Enter &get_value
Use of uninitialized value $result in concatenation (.) or string at ./check_ldap_monitor.pl line 395, <DATA> line 751.
VERBOSE 2 ===> Found value 
VERBOSE 3 ===> Leave &get_value
Use of uninitialized value $value in concatenation (.) or string at ./check_ldap_monitor.pl line 592, <DATA> line 751.
Use of uninitialized value $value in numeric lt (<) at ./check_ldap_monitor.pl line 597, <DATA> line 751.
Use of uninitialized value $value in concatenation (.) or string at ./check_ldap_monitor.pl line 598, <DATA> line 751.
OK -  current connections returned |'currentconnections'=;10;15

Cheers

coudot commented 5 years ago

Hello @bilbo-the-hobbit

This is because you define the base and not with the good value. Don't define the base, or set the correct entry (like cn=Current,cn=Connections,cn=Monitor for currentconnections). By defaut the script selects the correct base.

coudot commented 5 years ago

But we should indeed return an error code in this case.

coudot commented 5 years ago

Fixed. You should now have this error message:

perl check_ldap_monitor.pl -H ldap://localhost -b cn=monitor -T currentconnections -m greater -w 10 -c 15 -f -vvv           
VERBOSE 3 ===> Enter &get_ldapconn
VERBOSE 2 ===> Connected to ldap://localhost
VERBOSE 2 ===> Bind anonym
VERBOSE 3 ===> Leave &get_ldapconn
VERBOSE 3 ===> Enter &get_value
VERBOSE 1 ===> Attribute monitorCounter not found in cn=Monitor
LDAP search failed: Attribute monitorCounter not found.