Nagios remote nrpe check_disk returns permission denied

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Nagios remote nrpe check_disk returns permission denied

Postby sinaowolabi » Fri Jun 16, 2017 6:10 am

Hi!

I have a problem with remote check_disk command using check_disk.
The remote server (RHEL 7.2) has nrpe installed and when I run check_disk locally, I get correct response:
/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -A -X configfs -X cgroup -X tmpfs -X selinuxfs -X sysfs -X proc -X mqueue -X binfmt_misc -X devtmpfs
DISK OK - free space: / 7231 MB (25% inode=92%); /boot 266 MB (62% inode=99%); /tmp 9387 MB (99% inode=99%); /var/log 95114 MB (99% inode=99%); /dataspace 87398 MB (22% inode=99%); /var/lib/docker/devicemapper 7231 MB (25% inode=92%);

But trying to run it from nagios server via nrpe returns:
/usr/lib64/nagios/plugins/check_nrpe -H server -c check_hda1
DISK CRITICAL - /var/lib/docker/devicemapper/mnt/39f72d56797955d3a4d9c21221b6da1ef3b98d0b165d89dd371cc70e80908009 is not accessible: Permission denied

Ive disabled SELinux on the remote server, Ive added permissions via sudo to allow nrpe and nagios user commands to run:
User_Alias NRPERS = nagios, nrpe
Cmnd_Alias NRPERSCOMMANDS = /usr/lib64/nagios/plugins/eventhandlers/fix_ipsec, /usr/bin/docker inspect *, /usr/lib64/nagios/plugins/check-docker-container.sh *
Defaults:NRPERS !requiretty
NRPERS ALL=(root) NOPASSWD: NRPERSCOMMANDS



Please what could be the problem?
sinaowolabi
 
Posts: 8
Joined: Wed Apr 16, 2014 3:06 am

Re: Nagios remote nrpe check_disk returns permission denied

Postby tgriep » Fri Jun 16, 2017 12:21 pm

Try adding the path to the check_disk plugin to your Cmmd_Alias NRPERSCOMMANDS line in your /etc/sudoers like the example below.
Code: Select all
Cmnd_Alias NRPERSCOMMANDS = /usr/lib64/nagios/plugins/eventhandlers/fix_ipsec, /usr/bin/docker inspect *, /usr/lib64/nagios/plugins/check-docker-container.sh *, /usr/lib64/nagios/plugins/check_disk

Also, in the nrpe command definition put the sudo command in it so when the agent runs it, it will run it as root.
Code: Select all
command[check_hda1]=/usr/bin/sudo /usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -A -X configfs -X cgroup -X tmpfs -X selinuxfs -X sysfs -X proc -X mqueue -X binfmt_misc -X devtmpfs

Both of those changes should get the check_disk to run as root and fix the error you are receiving.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 5330
Joined: Thu Oct 30, 2014 9:02 am

Re: Nagios remote nrpe check_disk returns permission denied

Postby sinaowolabi » Sat Jun 17, 2017 3:56 pm

Thanks a lot, that worked!
sinaowolabi
 
Posts: 8
Joined: Wed Apr 16, 2014 3:06 am

Re: Nagios remote nrpe check_disk returns permission denied

Postby tgriep » Mon Jun 19, 2017 9:20 am

Your welcome, glad it is working. I'll mark the post as solved and lock it. If you have any questions in the future, feel free to open a new post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 5330
Joined: Thu Oct 30, 2014 9:02 am


Return to Nagios Core

Who is online

Users browsing this forum: Bing [Bot] and 7 guests