check_mount says nothing is mounted
-
- Posts: 8
- Joined: Thu Feb 18, 2021 2:42 pm
check_mount says nothing is mounted
We have stood up a new RHEL7 server. The config files appear to be set up the same. However, with the check_mount command, it says that nothing is mounted. I did some additional checking and the plugin is running a check of the contents of fstab vesus the output of the mount command. The mount command is returning null. Other plugins run by the 'nrpe' user seem to be working fine. Ideas?
Re: check_mount says nothing is mounted
Hello,
Thanks for reaching out.
What command parameters are you running on the check_mount plugin? And, you have tried to run as sudo as well with the same results?
Also please check to see if selinux is enabled? This could be preventing the script from successfully running.
Here is an example that I ran:
Thanks,
Perry
Thanks for reaching out.
What command parameters are you running on the check_mount plugin? And, you have tried to run as sudo as well with the same results?
Also please check to see if selinux is enabled? This could be preventing the script from successfully running.
Code: Select all
sestatus
Code: Select all
./check_mount.sh /dev/sda1 ext4
OK - /dev/sda1 mounted under ext4.
check_mount.sh v1.02
Perry
-
- Posts: 8
- Joined: Thu Feb 18, 2021 2:42 pm
Re: check_mount says nothing is mounted
So we have the Nagios plugins installed in /usr/lib64/nagios/plugins. The script we are running is the same as in many other hosts within our environment.
If I run it under sudo, it works. However, if it runs through Nagios, I've determined that the output of
is blank.
As I said, I have other hosts in our environment that it works fine. I've check the other Nagios cfg files, sudoers cfg, etc.
Code: Select all
#!/bin/bash
# Compare /etc/fstab to mounts command report not in mounts. Ignore proc, rpc_pipefs, swap, and blank lines
MISSINGFS=$(comm -23 <(awk '!/^($|#|.*swap.*|.*tmpfs.*|proc)/{print $2}' /etc/fstab | sort) <(mount | awk '!/(\/proc|rpc_pipefs|tmpfs)/{print $3}' | sort))
MOUNTSNUM=$(mount | awk '!/(\/proc|rpc_pipefs|tmpfs)/{print $3}' | sort | wc -l)
EXITMESSAGE="OK - All /etc/fstab declarations are mounted"
if [ -n "$MISSINGFS" ]; then
EXITMESSAGE="Filesystem(s) in /etc/fstab not mounted: "$(echo $MISSINGFS|xargs)
EXITSTATUS=2
fi
EXITMESSAGE=$EXITMESSAGE"|'mounts'="$MOUNTSNUM
echo $EXITMESSAGE
exit $EXITSTATUS
Code: Select all
(mount | awk '!/(\/proc|rpc_pipefs|tmpfs)/{print $3}' | sort)
As I said, I have other hosts in our environment that it works fine. I've check the other Nagios cfg files, sudoers cfg, etc.