3

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?

2
  • 1
    Did 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.
    – Khaled
    May 9, 2012 at 9:08
  • Very nicely spotted. That was the problem. The permissions of check_mountpoints.sh were 750, which had to be 755.
    – Sandra
    May 9, 2012 at 9:13

3 Answers 3

5

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.

4
  • You are a genius! The permissions of check_mountpoints.sh had to be changed to 755. Doing that solved the problem =)
    – Sandra
    May 9, 2012 at 9:11
  • I'm glad that i can help you. Since the problem is resolved, please accept the answer.
    – ercpe
    May 9, 2012 at 9:13
  • This 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 Jan 17, 2019 at 16:39
  • I 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.
    – gkephorus
    Jan 8, 2021 at 10:26
1

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
0

To fix this issue without making the nagios plugin world-readable and/or world-executable, add the nrpe user to the nagios group.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .