0

I'm running NRPE on a server with the check_disk command. I have setup sudo and the command works ok as the nagios user on the server.

command[check_disk]=/usr/bin/sudo /usr/local/nagios/libexec/check_disk -w 10% -c 5% -x /dev/cdrom -x /dev/shm -x /nfs01 -x /nfshome -x /mnt/hlmon01/shared -x /mnt/hlmon01/shared -A -i '.gvfs'

/usr/bin/sudo /usr/local/nagios/libexec/check_disk -w 10% -c 5% -x /dev/cdrom -x /dev/shm -x /nfs01 -x /nfshome -x /mnt/hlmon01/shared -x /mnt/hlmon01/shared -A -i '.gv fs' 
DISK OK - free space: / 44730 MB (93% inode=98%); /boot 351 MB (78% inode=99%); /var/lib/xenstored 5593 MB (99% inode=99%); /poolfsmnt/0004fb0000050000577933960ee5846b 102134 MB (99% inode=99%); /OVS/Repositories/0004fb0000030000755a9cd0ee8ac4da 1736686 MB (33% inode=33%);| /=2962MB;45241;47754;0;50268 /boot=95MB;428;452;0;476 /var/lib/xenstored=0MB;5033;5313;0;5593 /poolfsmnt/0004fb0000050000577933960ee5846b=265MB;92160;97280;0;102400 /OVS/Repositories/0004fb0000030000755a9cd0ee8ac4da=3506194MB;4718592;4980736;0;5242880

When I run this command on the nagios server I am getting the following error:

./check_nrpe -H test_server -c check_disk 
NRPE: Unable to read output

Can anyone help me out on how to debug this?

Thanks

Paul Haldane
  • 4,457
  • 1
  • 20
  • 31
John S
  • 3
  • 1
  • 4
  • 1
    Worth reviewing the suggestions in http://serverfault.com/questions/313959/sudo-nrpe-sorry-you-must-have-a-tty-to-run-sudo – Paul Haldane Oct 19 '16 at 20:26
  • Anything in the NRPE log file and/or /var/log/messages or /var/log/syslog? Do other nrpe checks on that host work? Is it just ones that use sudo that fail? – Paul Haldane Oct 19 '16 at 20:27
  • I verified from the link that nagios is running nrpe. nagios 1116 1 0 Oct19 ? 00:00:13 /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d I have't found anything so far in any logs on either server. – John S Oct 20 '16 at 11:45
  • Possibly the most common nagios question on SF: http://serverfault.com/search?q=%5Bnagios%5D+nrpe+unable+to+read+output – Keith Oct 20 '16 at 18:12

2 Answers2

0

Hi with which user did your run: /usr/bin/sudo /usr/local/nagios/libexec/check_disk -w 10% -c 5% -x /dev/cdrom -x /dev/shm -x /nfs01 -x /nfshome -x /mnt/hlmon01/shared -x /mnt/hlmon01/shared -A -i '.gv fs' ?

Try to run this command doing "su - [the user your nagios agent runs]" before.

Hadrien Huvelle
  • 136
  • 1
  • 6
  • I'm running the command as nagios and it works on the server running nrpe. I just can't get the results to return using nrpe on the other server. Other commands are being returned from the other server. I have to run this command as root because of OVM and two mounts that nagios doesn't have permissions to. – John S Oct 20 '16 at 11:47
0

This is likely to be selinux stopping sudo access from nrpe. Try disabling selinux temporarily on the server that you're monitoring with

setenforce permissive

If that makes things work then you need to decide if you're happy just making this permanent or if you're prepared to update the selinux policy to make it work. If you look in /var/log/audit/audit.log you should see the denials that are causing the issue.

There's some discussion of related issues here - SELinux prevents Nagios plugins from running on RHEL6 That's talking about Red Hat derived distributions, I'm not sure what version of Linux you're using on these systems.

Paul Haldane
  • 4,457
  • 1
  • 20
  • 31