Build precise queries to find exactly what you need
Press ESC to close
Join our next live webinar: “Advanced Nagios Monitoring Techniques” – Register Now
Your review has been submitted and is pending approval.
Shell Script for Nagios, checks if the FS given is mounted. Assumes that you are checking NFS by default, but it can check for any type of FS:
NFS, NFSv4, CIFS, JFS, JFS2, EXT2, EXT3, EXT4, etc (If a FS is mounted more than once it gives a Warning & reports the number of mounts).
This script do not check fstab or /etc/filesystem or other tab entries, as it is designed to consume as little CPU time as possible and to be used in different OS types.
It is a simple script, but it detects mounts of practically any type of FS, and multiple instances mounted of the same FS.
Verified compatible with the following OS: IBM AIX v5.2-v7.2 RHEL v4.8-v6.6, RHL v9 Ubuntu v10.04-v18.04 LTS SuSe v11 CentOS v6.5-10 CygWin v2.0.4-v2.5.1 & BusyBox v1.22.1 Oracle Solaris x86 v10-v11.3 SCO OpenServer v6.0.0 SCO UnixWare v7.1.4+, v7.1.4
Released under GPLv3. Author: Carlos Ijalba – 2016-2018.
Current Version
1.02
Last Release Date
2018-08-21
Owner
Carlos Ijalba
Website
https://ijalba.wordpress.com/
License
GPL
Compatible With
check_mount.sh shell script
Shell Script for Nagios, checks if the FS passed on $1 is mounted under Mount Type $2. If no parameter passed on $2 NFS type is assumed by default. This script do not check fstab or /etc/filesystem or other tab entries, as it is designed to consume as little CPU time as possible and to be used in different OS types. It is a simple script, but it detects mounts of practically any type of FS, and multiple instances mounted of the same FS. Verified compatible with the following OS: IBM AIX v5.2-v7.2 RHEL v4.8-v6.6, RHL v9 Ubuntu v10.04-v18.04 LTS SuSe v11 CentOS v6.5-10 CygWin v2.0.4-v2.5.1 & BusyBox v1.22.1 Oracle Solaris x86 v10-v11.3 SCO OpenServer v6.0.0 SCO UnixWare v7.1.4+, v7.1.4 Released under GPLv3, feel free to use and modify, please give credits and references when appropriate. Author: Carlos Ijalba - 2016-2018. Alerts given to Nagios: OK - "/exports" mounted under "NFS". CRITICAL - "/exports" not mounted under "NFS". WARNING - "/exports" is mounted several times! (3) ------------- USE: check_mount.sh [ $1 - Filesystem ] | optional: [ $2 - Type (NFS by default)] Reports: OK - $1 mounted under $2. CRITICAL - $1 not mounted under $2. WARNING - $1 is mounted several times! (number of times mounted) Examples: check_mount.sh /developer/logs <-- check NFS mount of /developer/logs check_mount.sh /developer cifs <-- check CIFS mount of /developer check_mount.sh /ora12c nfs4 <-- check NFSv4 mount of /ora12c check_mount.sh /db2 ext3 <-- check EXT3 mount of /db2 check_mount.sh /CICS jfs2 <-- check JFS2 mount of /CICS ------------- NAGIOS Plugin Version Control: After the Nagios Status reported, the script shows the script's name and version, very useful to track nagios services versions and scripts invoked by a service/command.
Just works out of the box with minimal dependencies
Had to modify the script as shown below so that it wouldn't alarm if one mount was a subset of another (e.g. /mnt/foo and /mnt/foo_new would alarm, saying "/mnt/foo is mounted several times (2)" Old line 107: MOUNTED=`mount | grep $MOUNT | grep $FS | wc -l | tr -s " "` # execute the command to check the mount... New line 107: MOUNTED=`mount | grep "$MOUNT" | grep " $FS " | wc -l | tr -s " "` # execute the command to check the mount...
Thanks for the bug report candreasen, I have modified the script with a bug correction and added a small CPU & memory speedup. Note that your suggested line also won't work correctly in all OS, so i have only put one space after the FS, to act as a delimiter, and removed the space before the FS. I will post the updated script now.
You must be logged in to submit a review.
To:
From: