Hi Everyone,
Hope you all are good !!!
I am using the Nagios Core 4.4.5
We are monitoring the Mount Points using the Script: "./check_mount.sh"
https://exchange.nagios.org/directory/P ... is/details
For one of our host, some mount points are showing as Not mounted under FS. Whereas, when we are checking manually at the server end and running the command manually. Then it is showing correct output and also getting the service status as Ok in Nagios. But after some time some of the mount points are showing as not mounted until we do not run the command manually.
Kindly suggest.
Thank you so much in advance!!!
Mount Point Monitoring
-
s.diwakar1
- Posts: 44
- Joined: Thu Feb 27, 2020 9:45 am
Mount Point Monitoring
Thanks & Regards,
Diwakar Sharma
Diwakar Sharma
Re: Mount Point Monitoring
The code of the plugin looks pretty straight forward:
The key part being:
Where $FS is an argument passed to the plugin.
Is the mount suppose to always be attached or is it attached only for certain users like when the log in? Is it possible that someone or something is unmounting it?
What account are you using to run the command manually? When Nagios automatically runs it, the script is going to run via some agent like ssh, ncpa, nrpe which would use likely use a different account(nagios account probably) to execute it. You can try to switch to this account and run the plugin:
Code: Select all
MOUNTED=`mount | grep "$MOUNT" | grep -c "$FS "` # execute the command to check the mount...
if [ $MOUNTED -eq 0 ]; then
MSG="CRITICAL - $FS not mounted under $MOUNT."
RC=$NAGIOS_CRIT
elif [ $MOUNTED -eq 1 ]; then
MSG="OK - $FS mounted under $MOUNT."
RC=$NAGIOS_OK
else
MSG="WARNING - $FS is mounted several times! ($MOUNTED)"
RC=$NAGIOS_WARN
fiCode: Select all
mount | grep "$MOUNT" | grep -c "$FS"Is the mount suppose to always be attached or is it attached only for certain users like when the log in? Is it possible that someone or something is unmounting it?
What account are you using to run the command manually? When Nagios automatically runs it, the script is going to run via some agent like ssh, ncpa, nrpe which would use likely use a different account(nagios account probably) to execute it. You can try to switch to this account and run the plugin:
Code: Select all
su - nagiosAs of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
s.diwakar1
- Posts: 44
- Joined: Thu Feb 27, 2020 9:45 am
Re: Mount Point Monitoring
After executing the script manually using Nagios Account, the output is same as on Nagios Console (not mounted under FS). But the FSs are mounted to the server.
Can you please suggest what to do next?
Can you please suggest what to do next?
Thanks & Regards,
Diwakar Sharma
Diwakar Sharma
Re: Mount Point Monitoring
Since it works are root and not nagios, it may need to run via sudo. I'd have a look at the sudoers config for syntax and put it under /etc/sudoers.d/ in a separate file.