NRPE Not Working

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
troche
Posts: 7
Joined: Tue Jul 19, 2016 9:00 am

NRPE Not Working

Post 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?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: NRPE Not Working

Post 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)
Former Nagios Employee
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: NRPE Not Working

Post by hsmith »

What user are you running this as on the terminal of your Nagios server?
Former Nagios Employee.
me.
troche
Posts: 7
Joined: Tue Jul 19, 2016 9:00 am

Re: NRPE Not Working

Post 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.
troche
Posts: 7
Joined: Tue Jul 19, 2016 9:00 am

Re: NRPE Not Working

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE Not Working

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
troche
Posts: 7
Joined: Tue Jul 19, 2016 9:00 am

Re: NRPE Not Working

Post 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.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: NRPE Not Working

Post 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?
Former Nagios Employee
troche
Posts: 7
Joined: Tue Jul 19, 2016 9:00 am

Re: NRPE Not Working

Post by troche »

Yes, as both the nagios and root users.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE Not Working

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked