Manual check works, with NRPE returns error

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.
Locked
jpeery
Posts: 14
Joined: Wed Oct 24, 2012 9:51 am

Manual check works, with NRPE returns error

Post 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
Last edited by jpeery on Thu Feb 04, 2016 1:36 pm, edited 1 time in total.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Manual check works, with NRPE returns error

Post 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.
Former Nagios Employee.
me.
jpeery
Posts: 14
Joined: Wed Oct 24, 2012 9:51 am

Re: Manual check works, with NRPE returns error

Post 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
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Manual check works, with NRPE returns error

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