Module: check_mk
Branch: master
Commit: d46c7d6fe8a88bceeaddc8df436ad72ff4dafede
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d46c7d6fe8a88b…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Apr 3 14:57:57 2014 +0200
New localcheck for Linux that makes sure that filesystems in /etc/fstab are mounted
The new local check is in
<tt>share/doc/check_mk/treasures/localchecks/check_fstab_mounts</tt>. Simply
copy it to <tt>/usr/lib/check_mk_agent/local/</tt> on your Linux agents. It
will alert you if any
filesystem that is listed in <tt>/etc/fstab</tt> is not being mounted.
Filesystems with the option
<tt>noauto</tt> are excluded from the check.
---
.werks/751 | 11 ++++++++
ChangeLog | 1 +
doc/treasures/localchecks/check_fstab_mounts | 37 ++++++++++++++++++++++++++
3 files changed, 49 insertions(+)
diff --git a/.werks/751 b/.werks/751
new file mode 100644
index 0000000..b20f4c2
--- /dev/null
+++ b/.werks/751
@@ -0,0 +1,11 @@
+Title: New localcheck for Linux that makes sure that filesystems in /etc/fstab are
mounted
+Level: 1
+Component: checks
+Version: 1.2.5i3
+Date: 1396529750
+Class: feature
+
+The new local check is in
<tt>share/doc/check_mk/treasures/localchecks/check_fstab_mounts</tt>. Simply
+copy it to <tt>/usr/lib/check_mk_agent/local/</tt> on your Linux agents. It
will alert you if any
+filesystem that is listed in <tt>/etc/fstab</tt> is not being mounted.
Filesystems with the option
+<tt>noauto</tt> are excluded from the check.
diff --git a/ChangeLog b/ChangeLog
index d3e785a..527b30f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
1.2.5i3:
Checks & Agents:
* 0149 cisco_secure: New check for Port Security on Cisco swichtes
+ * 0751 New localcheck for Linux that makes sure that filesystems in /etc/fstab are
mounted...
* 0777 FIX: special agent emcvnx: did not work with security file authentication...
Multisite:
diff --git a/doc/treasures/localchecks/check_fstab_mounts
b/doc/treasures/localchecks/check_fstab_mounts
new file mode 100755
index 0000000..40b4e0a
--- /dev/null
+++ b/doc/treasures/localchecks/check_fstab_mounts
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+# This localcheck makes sure that every filesystem that is listed in /etc/fstab to
+# be mounted automatically, also appears mounted in /proc/mounts
+
+# /dev/mapper/vg0-lv--root / ext4 errors=remount-ro 0 1
+# # /boot was on /dev/md0 during installation
+# UUID=bec44dfa-7c70-4da7-857a-2e324cc230bd /boot ext4 defaults 0
2
+# /dev/mapper/vg0-lv--home /home ext4 defaults 0 2
+# tmpfs /omd/sites/aq/tmp tmpfs noauto,user,mode=755,uid=aq,gid=aq 0 0
+# tmpfs /opt/omd/sites/zentrale/tmp tmpfs noauto,user,mode=755,uid=zentrale,gid=zentrale
0 0
+# tmpfs /opt/omd/sites/hirn/tmp tmpfs noauto,user,mode=755,uid=hirn,gid=hirn 0 0
+# tmpfs /opt/omd/sites/heute/tmp tmpfs noauto,user,mode=755,uid=heute,gid=heute 0 0
+
+mounted = [ l.split()[1] for l in file("/proc/mounts") ]
+
+missing = []
+count = 0
+for line in file("/etc/fstab"):
+ if not line.strip() or line.strip().startswith("#"):
+ continue
+
+ device, mountpoint, fstype, options, rest = line.split(None, 4)
+ options = options.split(",")
+ if "noauto" not in options and mountpoint not in mounted:
+ missing.append("%s is not mounted on %s" % (device, mountpoint))
+ else:
+ count += 1
+
+if missing:
+ state = 2
+ output = ", ".join(missing)
+
+else:
+ state = 0
+ output = "All %d expected filesystems of /etc/fstab are mounted" % count
+
+print "%d Mounted_Filesystems - %s" % (state, output)