How can I resolve "(Service check did not exit properly)" and "(null)" results with my services?
Nagios includes its own embedded perl interpreter. Your plugin is probably not epn compliant.
You might want to disable it globally, or just disable it for your script. The bottom of that docs page shows you how to do this.
Basically, add # nagios: -epn
on its own line somewhere within the first ten lines of your script. This should fix your problem.
You could also make it compliant, but it's almost certainly not worth the trouble.
Some Perl scripts from the Nagios Exchange will try to include the utils.pm
Perl module. You'll find a line like this somewhere in it:
use lib "/usr/local/nagios/libexec";
When installing Nagios on Debian, the default location of the utils.pm
file is /usr/lib/nagios/plugins/utils.pm
. So the use lib
directive should be:
use lib "/usr/lib/nagios/plugins";
Executing the command from the command line most likely worked because you were in /usr/lib/nagios/plugins/
, editing your plugin.
Prefix the command with /usr/bin/perl
.
This solution is more of a workaround, it's probably not a good idea to do so but at least your plugin should work the same way it does when you launch it from the terminal.
NOTE: In my experience # nagios -epn
works quite often, but sometimes it doesn't seem to be enough. I noticed that when this happens, the faulty plugins reports many warnings (when the script is invoked with perl -w
).