Are you facing Nagios error, NRPE: No Output Returned From Plugin?
This guide is for you.
With NRPE, we can remotely execute Nagios plugins on remote Linux/Unix machines.
In addition, it can communicate with a few Windows agent addons.
Hence we can execute scripts and check metrics on remote Windows machines as well.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Nagios queries.
In this context, we shall look into how to resolve the error NRPE: No Output Returned From Plugin.
Main causes of this error are outlined below:
i. Incorrect permissions
ii. Missing plugin
iii. Mismatch of Arguments between Nagios XI and nrpe.cfg
1. Incorrect permissions
A common solution is to check the permissions on the check_nrpe binary on the Nagios XI server:
$ ls -la /usr/local/nagios/libexec/check_nrpe
The permissions should resemble:
-rwxrwxr-x. 1 nagios nagios 75444 Nov 21 01:38 check_nrpe
If not, we change ownership to user/group "nagios" and fix up the permissions:
$ chown nagios:nagios /usr/local/nagios/libexec/check_nrpe
$ chmod u+rwx /usr/local/nagios/libexec/check_nrpe
$ chmod u+rx /usr/local/nagios/libexec/check_nrpe
2. Missing Plugin
In the case of a missing plugin file, in order to receive this error, we usually have to experience a secondary configuration issue.
This occurs when the plugin referenced by the command directive in nrpe.cfg is either missing from the libexec folder or an incorrect command directive name.
This also implies that the command name passed through NRPE from the Nagios XI server does not define in the nrpe.cfg file on the remote host.
In order to troubleshoot, we need the name of the command we request NRPE to execute.
i. For instance, ensure the command is defined in nrpe.cfg on our remote host:
$ command[check_foo]=/usr/local/nagios/libexec/check_foo.sh $ARG1$
ii. Then, verify if the spelling of check_foo in $ARG1$ matches that of the command directive name command[check_foo].
iii. Next, ensure the plugin to execute on the remote host actually exists.
For example, here, the name of the plugin is:/usr/local/nagios/libexec/check_foo.sh
We execute the following command on the remote host to see if it exists:
$ ls -la /usr/local/nagios/libexec/check_foo.sh
If it does not exist, then our output will be like this:
ls: cannot access /usr/local/nagios/libexec/check_foo.sh: No such file or directory
If this is the problem, we have to copy the plugin to the /usr/local/nagios/libexec/ folder.
We ensure the filename check_foo.sh has the correct file extension.
3. Mismatch of Arguments between Nagios XI and nrpe.cfg
Usually, a secondary issue is an argument usage mismatch between the remote host's nrpe.cfg command directive and the arguments passed by Nagios XI through check_nrpe.
If we pass arguments, the argument usage should be consistent between the Nagios XI service check and the arguments declared in the command directive in the remote host's nrpe.cfg.
Additionally, check the remote host’s nrpe.cfg for the dont_blame_nrpe directive.
For example, consider this command executed on the Nagios XI server:
$ /usr/local/nagios/libexec/check_nrpe -H 10.25.13.30 -t 30 -c check_users -a ‘-w 5 -c 10’
To identify the setting NRPE server has defined, we log into the remote host as the root user and execute:
$ grep -e ^dont /usr/local/nagios/etc/nrpe.cfg
The expected output will be like this: