Page 1 of 1

Manual check works, with NRPE returns error

Posted: Thu Feb 04, 2016 12:13 pm
by jpeery
Hi all, have been banging my head on this one, and was wondering if anyone has any suggestions. I'm working with checking NFS mounts in a RHEL 6 environment, using Nagios Core 4.1 and NRPE 2.15. I'm using two different scripts I got from the exchange, check_nfs.sh and check_mountpoints.sh (https://exchange.nagios.org/directory/P ... sh/details, https://exchange.nagios.org/directory/P ... 2E/details).

So here's the thing, if I run these manually, they work FINE, when run with check_nrpe, they each throw an error, and I have no idea what check_nrpe is doing that would cause this behavior. For example:

[root@blah libexec]# ./check_nfs.sh
OK - NFS mounts are functioning within normal operating parameters
[root@blah libexec]# ./check_nrpe -H localhost -c check_nfs
CRITICAL - NFS mounts may be stale or unavailable

[root@blah libexec]# ./check_mountpoints.sh -a
OK: all mounts were found (/mnt/jomama )
[root@blah libexec]# ./check_nrpe -H localhost -c check_nfs_mounts
CRITICAL: /mnt/jomama doesn't exist on filesystem ;

Command defs from nrpe.cfg:
command[check_nfs_mounts]=/usr/local/nagios/libexec/check_mountpoints.sh -a
command[check_nfs]=/usr/local/nagios/libexec/check_nfs.sh

For the mount that fails I have verified that it is there, mounted, I can cd to it, touch a file, remove, etc, so it appears to be fine, and it appears to be fine in /etc/fstab. I can unmount, and do a mount -a and it mounts fine... So I am pretty sure the mount is ok, and defined ok, there just seems to be something I can't grasp with how the script is getting run by check_nrpe.

TIA,
Jason

Re: Manual check works, with NRPE returns error

Posted: Thu Feb 04, 2016 12:21 pm
by hsmith
On the remote machine that the check works fine manually on, can you su to the nagios user, and try to run the script again? This sounds a lot like a permissions issue.

Re: Manual check works, with NRPE returns error

Posted: Thu Feb 04, 2016 1:35 pm
by jpeery
I'll gladly wear my dunce cap now... Appears to be perms, the one thing I didn't actually check and just assumed. Thanks!

[root@blah libexec]# su - nagios -c "/usr/local/nagios/libexec/check_nfs.sh"
stat: cannot read file system information for `/mnt/jomama': Permission denied
CRITICAL - NFS mounts may be stale or unavailable

Re: Manual check works, with NRPE returns error

Posted: Thu Feb 04, 2016 4:00 pm
by bwallace
No worries, we'll go ahead and lock this thread now. Feel free to open another if you need assistance with anything else.