The FreeBSD Diary |
(TM) | Providing practical examples since 1998If you buy from Amazon USA, please support us by using this link. |
NRPE: Unable to read output
4 October 2010
|
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: command[check_freshports_queues]=/usr/local/libexec/nagios/check_freshports_queue 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: #!/bin/sh cd /usr/websites/freshports.org/scripts/ ./queue-status.pl 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 13 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 ./queue-status.pl Can't locate email.pm 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 utilities.pm line 13. Compilation failed in require at ./queue-status.pl line 11. BEGIN failed--compilation aborted at ./queue-status.pl 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. |