How to debug Nagios "NRPE: Unable to read output" when checking NFS?
Solution 1
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.
Solution 2
I had the same problema, many times it was permission. Setting permission or using sudoers solve it.
Try to login with nrpe/nagios user (su - nrpe) and try to run the command.
Other possibilite is the selinux, try to disable is TO TEST:
echo 0 > /selinux/enforce
Related videos on Youtube
Sandra
Updated on September 18, 2022Comments
-
Sandra almost 2 years
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?
-
Admin about 12 yearsDid you try to run the same script with nagios user? I can see that you are running it as root in the working example above.
-
Admin about 12 yearsVery nicely spotted. That was the problem. The permissions of
check_mountpoints.sh
were750
, which had to be755
.
-
-
Sandra about 12 yearsYou are a genius! The permissions of
check_mountpoints.sh
had to be changed to 755. Doing that solved the problem =) -
ercpe about 12 yearsI'm glad that i can help you. Since the problem is resolved, please accept the answer.
-
Giuseppe Salvatore over 5 yearsThis was a really good suggestion. Problem is that in my case, looking at the output of strace is actually a pain. I might try to interpret it but I can't figure out what is trying to tell
-
gkephorus over 3 yearsI had a permission problem within the commands file. I used sudo there where the nrpe-user (opsview) did not have sudo-rights. This causes the same error.