Linux – How to debug Nagios “NRPE: Unable to read output” when checking NFS

centoslinuxnagiosUbuntu

I have a working Nagios setup where I e.g. monitor disk usage through the NRPE daemon without parsing arguments through NRPE for security reasons. So I know that NRPE works.

Now I would like to check NFS using the check_mountpoints plugin, but I get

NRPE: Unable to read output 

On Nagios Monitor host I have set

define command {
  command_name check_mountpoints
  command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c check_mountpoints 
}

define service {
  use                     generic-service
  name                    check_mountpoints
  host_name               example.com
  service_description     Check_mountpoints for nfs cifs davfs
  check_command           check_nrpe!check_mountpoints
  contact_groups          linux-admins
}

On the remote host have I set

command[check_mountpoints]=/usr/lib/nagios/plugins/check_mountpoints.sh /nas1/home

To verify that the correct arguments have been given the command outputs this

[root@nas ~]# /usr/lib/nagios/plugins/check_mountpoints.sh /nas1/home
OK: all mounts were found ( /nas1/home)
[root@nas ~]# 

And both Nagios monitor host and remote host have a working NRPE daemon running.

Question

How do I debug something like this?

Best Answer

From my experience, this error is caused by missing permissions. You tried to execute the nrpe client script as root. Try to execute it as the user the nrpe daemon is running as. This should give you an hint towards the cause. If this does not help, try to run

strace usr/lib/nagios/plugins/check_mountpoints.sh /nas1/home

as the nrpe user.