2.3.0 breaks at least one legacy nagios plugin written in perl

I only use one legacy nagios plugin- check_ldap_syncrepl_status.pl, but the nature of the problem makes me think that most legacy nagios plugins written in perl will have this issue.

The problem is a shared library in version/lib. I do not know which one. It is not utils.pm.

Workaround is to wrap nagios plugin with a script that removes version/lib from LD_LIBRARY_PATH

#!/bin/bash

more_args=""
executable=$1

while [ "$2" != "" ]; do

    more_args="$more_args $2"

    # Shift all the parameters down by one
    shift

done

export LD_LIBRARY_PATH=$OMD_ROOT/local/lib

$executable $more_args

In the case of check_ldap_syncrepl_status.pl, the plugin will return a “Can’t connect to host” error if run as the omd user. Other users can run the plugin manually without error. The error message is misleading, as it never actually tries to connect to the host, but rather it errors while initializing a Net::LDAP object.

Edit- I forgot to mention that this is on Oracle Linux 9

1 Like

Thank you for the good workaround. I got my old check_plugin working again!

1 Like

Sweet. When I get weird issues like this, I often think it’s just me.

Thanks for the info.
I wrote this little wrapper in perl.

#!/bin/perl -w
use strict;

if(defined($ENV{'OMD_ROOT'})) {
  $ENV{'LD_LIBRARY_PATH'}=$ENV{'OMD_ROOT'}.'/local/lib';
  exec(@ARGV);
} else {
  print "This script must be run as a site owner to work\n";
  exit(2);
}
1 Like