Check mount point status using monit service

monitmonitoring

I would like to monitor the server "mount point status" using "monit".

Check filesystem is available to check whether that filesystem available or not on the systeam. But couldn't check filesystem mount point.Please correct me if its wrong. Since I tested this check locally , its not check the filesystem mount point, it checks only filesystem attached to server or not.

For some reason, my mount on the server getting disconnected frequently. so I would like to get an alert whenever mount gets disconnected.

Thanks in Advance

Best Answer

You could do it with a flag file (here server-nfs-a) located on the mounted point

check file mount-flag-nas-b with path /mount/NAS-A/server-nfs-a
      if does not exist then exec "/bin/mount /mount/NAS-A" else if succeeded then exec "/var/lib/monit/scripts/notifySuccess.sh"

Here I prefer to mount it when the file cannot be found due to missing mount.