Linux – How to make check_nrpe wait for the remote script to finish executing

linuxnagiosnrpepythonUbuntu

I have a python script that's being used as a plugin for NRPE. This script checks to see if a process if running on a virtual machine by doing an SSH one-liner with a "ps ax | grep process" attached. When executing the script manually, it works as expected and returns a single line of output for NRPE as well as a status based on whether or not the process is running.

When I attempt to run the command setup to execute this script (from my Nagios server), I instantly get the output "NRPE: Unable to read output", however when I run the script manually it takes about a second before it returns output. Other commands run just fine, so it would seem like NRPE needs to wait a second or two for output rather than instantly failing, but I've been unable to find any way of accomplishing this; any tips?

PS: The virtual machines are not accessible from anywhere other than the host machine, hence the need for the nrpe plugin to ssh from the host into the VM to check the process.

Best Answer

You can change the timeout by following the instructions here or searching timeout in the nrpe documentation, although I don't think this is your issue, or you'd see an error like this:

CHECK_NRPE: Socket timeout after 270 seconds.

There is also probably a nagios plugin that will return the data you want that has been written already.

Related Topic