Page 1 of 2
NRPE Not Working
Posted: Tue Jul 19, 2016 10:31 am
by troche
I am using NRPE and have created a number of custom commands. I distributed the nrpe.cfg file and all seems to work fine with the exception of displaying the correct information in the browser when using Nagios. I can access and run the check_nrpe command successfully from the server to the remote system (i.e. check_nrpe -H <host> -c ,custom command>) and receive a successful message (i.e. OK, WARNING, CRITICAL, etc.). But Nagios does not display this information correctly and instead displays the following "Return code of 127 is out of bounds - plugin may be missing". I can run the command on the remote system (i.e. <custom command>) and on the server as listed above and both work fine. But I can't seem to get the web app to display the correct info. Any ideas?
Re: NRPE Not Working
Posted: Tue Jul 19, 2016 10:46 am
by rkennedy
Usually this is related to permissions and the nagios user not being able to access the plugin. What are the permissions of the check_nrpe file? ls -la check_nrpe
Additionally, is your custom plugin using exit codes to exit properly? For example - exit 0 (as an OK status)
Re: NRPE Not Working
Posted: Tue Jul 19, 2016 10:47 am
by hsmith
What user are you running this as on the terminal of your Nagios server?
Re: NRPE Not Working
Posted: Tue Jul 19, 2016 11:14 am
by troche
The owner/permissions on check_nrpe were root/755. All the other plugins were nagios/755. Not sure how this happened but the permissions should have allowed this to work. I changed check_nrpe to nagios/755. As for the custom commands, they are merely common plugins with different arguments (i.e. check_mydisk = check disk ... /dev/mydisk).
Even after changing permission on check_nrpe it still gives the same errors.
Re: NRPE Not Working
Posted: Tue Jul 19, 2016 11:37 am
by troche
The other strange thing is that I have a number of custom commands defined. One of them works and some of the others do not.
Re: NRPE Not Working
Posted: Tue Jul 19, 2016 12:10 pm
by lmiltchev
Can you show us the actual check that you are running from the command line on the Nagios server, along with the output of it? Run the check twice, once as root, and once as nagios user.
Also, show us how the command is defined in the nrpe.cfg on the remote box.
Re: NRPE Not Working
Posted: Tue Jul 19, 2016 1:35 pm
by troche
I am using the generic check_disk plugin with -w, -c and -p arguments such as:
command[check_disk1]=/path/to/plugins/check_disk -w 10% -c 5% -p disk1
command[check_disk2]=/path/to/plugins/check_disk -w 10% -c 5% -p disk2
command[check_disk3]=/path/to/plugins/check_disk -w 10% -c 5% -p disk3
etc.
I am also doing the same for custom commands utilizing the check_load plugin.
Re: NRPE Not Working
Posted: Tue Jul 19, 2016 2:02 pm
by rkennedy
troche wrote:I am using the generic check_disk plugin with -w, -c and -p arguments such as:
command[check_disk1]=/path/to/plugins/check_disk -w 10% -c 5% -p disk1
command[check_disk2]=/path/to/plugins/check_disk -w 10% -c 5% -p disk2
command[check_disk3]=/path/to/plugins/check_disk -w 10% -c 5% -p disk3
etc.
I am also doing the same for custom commands utilizing the check_load plugin.
On the remote machine, as the nagios user, are you able to run
/path/to/plugins/check_disk -w 10% -c 5% -p disk1 and have it return the expected output?
Re: NRPE Not Working
Posted: Tue Jul 19, 2016 2:10 pm
by troche
Yes, as both the nagios and root users.
Re: NRPE Not Working
Posted: Tue Jul 19, 2016 3:55 pm
by lmiltchev
Can you show us the
actual commands? We need to make sure that your command is configured properly, your paths are correct, etc. Here's an example:
On the client (remote machine)
- the "df -h" output
Code: Select all
[root@192 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 9.4G 6.8G 2.6G 73% /
devtmpfs 2.0G 140K 2.0G 1% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/sda1 9.4G 6.8G 2.6G 73% /
- command run locally on the client
Code: Select all
[root@192 ~]# /usr/local/nagios/libexec/check_disk -w 10% -c 5% -p /
DISK OK - free space: / 2637 MB (27% inode=82%);| /=6877MB;8650;9131;0;9612
- command definition
Code: Select all
command[check_disk_new]=/usr/local/nagios/libexec/check_disk -w 10% -c 5% -p /
On the nagios server
Code: Select all
[root@localhost tmp]# /usr/local/nagios/libexec/check_nrpe -H <client ip> -c check_disk_new
DISK OK - free space: / 2637 MB (27% inode=82%);| /=6877MB;8650;9131;0;9612