NRPE: Unable to read output

NRPE: Unable to read output

In a sudden flash of inspiration, I realized I could replace some cronjobs and emails with a Nagios plugin.
This article assumes you know about Nagios and how to write a plugin. The main goal here is to show you
a debugging approach I found.

The problem

The problem was the the following entry in /usr/local/etc/nrpe.cfg:


When running it, I saw:

$ /usr/local/libexec/nagios/check_nrpe2 -H nyi-vpn -c check_freshports_queues
NRPE: Unable to read output

A Google search shows this means the script it not producing any output. The script contains:

cd /usr/websites/

I started by adding an echo $? to the script. Now the output changes

$ /usr/local/libexec/nagios/check_nrpe2 -H nyi-vpn -c check_freshports_queues

That’s the problem. The script isn’t running at all. No error output though. Let me try another
trick. On the remote server, become root, and then run the command from nrpe.cfg via su. This allows
you to run the command as the nagios user:

# su -m nagios -c ./
Can't locate in @INC (@INC contains: /usr/local/lib/perl5/5.8.9/BSDPAN /usr/local/lib/perl5/site_per           l/5.8.9/mach /usr/local/lib/perl5/site_perl/5.8.9 /usr/local/lib/perl5/5.8.9/mach /usr/local/lib/perl5/5.8.9            .) at line 13.
Compilation failed in require at ./ line 11.
BEGIN failed--compilation aborted at ./ line 11.

After a bit of playing, I had to do chmod o+rx on various .pm files. Once that was done, success:

$ /usr/local/libexec/nagios/check_nrpe2 -H supernews-vpn -c check_freshports_queues
Queues are OK

While this may not help you directly, it may give you some clues.

Leave a Comment

Scroll to Top