Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
We are running Nagios 4.1.1 on a Ubuntu Linux 14.04 LTS 64-bit server, and the client system in question is running Red Hat Enterprise Linux 7.2 64-bit release.
The folders that are the targets of the monitoring are located on an xfs filesystem on top of a logical volume. I have installed the nrpe 2.12 client as well as the
check_folder_size.sh script on the client.
The web interface on the Nagios server has the following output on-screen:
Quote:
Free Space /xfs4/dips1 UNKNOWN 03-27-2017 13:04:14 0d 0h 34m 15s 3/3 The filesystem doesnt exist or there is a script error
Free Space /xfs4/dips2 UNKNOWN 03-27-2017 13:04:14 0d 0h 37m 38s 3/3 The filesystem doesnt exist or there is a script error
Free Space /xfs4/dips3 UNKNOWN 03-27-2017 13:04:14 0d 0h 35m 38s 3/3 The filesystem doesnt exist or there is a script error
Free Space /xfs4/dips4 UNKNOWN 03-27-2017 13:04:14 0d 0h 33m 38s 3/3 The filesystem doesnt exist or there is a script error
Free Space /xfs4/dips5 UNKNOWN 03-27-2017 13:04:14 0d 0h 31m 38s 3/3 The filesystem doesnt exist or there is a script error
We have another server running Red Hat Enterprise Linux 6.6 that also has the check_folder_size.sh script on it, and it is not having this problem. I made sure to copy over the script from that system to the one having the problem.
Does anyone have an idea as to why this is occurring, and how it can be corrected?
I'd found similar issues long ago and was maddened by the fact it was working when I ran command as root but not when I did the check from my Nagios server. It turned out the reason it was failing from Nagios server was I'd configured the nrpe client (via xinetd) to run as user "nagios". Running on the client as that user I had the same error as I'd seen from the Nagios master server.
Ultimately my issue turned out to be that the user "nagios" on the client didn't have permissions to read the filesystem at all but it was difficult to get to that point until I realized that was the user that was doing the check (i.e. NOT the root user.)
Thank-you for your email. I tried recompiling the nrpe and nagios-plugins with user and group set to root. However, the nrpe client refused to start with user and group set to root. I then recompiled again with user and group set to nagios, and this time I changed the shell for nagios to bash, and I also made nagios, as far as the du command was concerned, a member of the sudo group. When I ran the following command interactively:
Quote:
# su - nagios /usr/local/nrpe/libexec/check_folder_size.sh 150000 200000 /xfs4/dips1
The command completed successfully. However, even with these changes, the same error messages continued to occur.
What does "ls -ld /xfs" and "ls -ld /xfs4/dips1" show?
My suggestion wouldn't really be to run nrpe as root but rather give permissions to /xfs/dips1 to allow user "nagios" to access it. You don't have to give write access.
If you're using ACLs or SELinux you might have to do other steps to allow permission.
The ls -ld command on the directory had the following output:
Quote:
# ls -ld /xfs4/dips1/
drwxr-xr-x. 10 root root 4096 Mar 27 11:09 /xfs4/dips1/
I changed the permissions on the directory to the following:
Quote:
drwxrwxr-x. 4 root root 49 Mar 6 2010 dips1
There was no improvement when I restarted the nrpe client.
I checked the selinux setting, and it is set to enforcing. However, another system running RHEL 6.6 has a similar setting, and the script is working without issue there.
I checked the output of the strace command further, and the following entry was present:
Quote:
Process 131343 attached
[pid 131343] execve("/usr/bin/sudo", ["sudo", "/usr/bin/du", "-shL", "/xfs4/dips1"], [/* 26 vars */]) = 0
[pid 131343] +++ exited with 1 +++
I ran the above command interactively in the following manner:
Quote:
su - nagios /usr/bin/sudo /usr/bin/du -shL /xfs4/dips1
The output that I got was the following:
Quote:
su: failed to execute hL: No such file or directory
I checked the du man page on the system, and the -shL options are listed as available. Also, when I ran the command as root, it completed successfully.
It restricts to run sudo interactively only, by checking the current terminal, like the tty command does.
This is by default activated in Centos/RedHat - not in SuSE.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.