Module: check_mk
Branch: master
Commit: 5d16051a5b90899a5e13c9c7797e7525e2c3b3ff
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5d16051a5b9089…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jul 2 10:31:38 2018 +0200
6280 Analyze configuration: Add performance test for mounted tmpfs
---
.werks/6280 | 10 ++++++++++
web/plugins/wato/ac_tests.py | 47 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+)
diff --git a/.werks/6280 b/.werks/6280
new file mode 100644
index 0000000..b342f37
--- /dev/null
+++ b/.werks/6280
@@ -0,0 +1,10 @@
+Title: Analyze configuration: Add performance test for mounted tmpfs
+Level: 1
+Component: wato
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1530520260
+Class: feature
+
+
diff --git a/web/plugins/wato/ac_tests.py b/web/plugins/wato/ac_tests.py
index 6541a0c..f73b850 100644
--- a/web/plugins/wato/ac_tests.py
+++ b/web/plugins/wato/ac_tests.py
@@ -158,6 +158,53 @@ class ACTestLivestatusUsage(ACTest):
+class ACTestTmpfs(ACTest):
+ def category(self):
+ return ACTestCategories.performance
+
+
+ def title(self):
+ return _("Temporary filesystem mounted")
+
+
+ def help(self):
+ return _("<p>By default each Check_MK site has it's own temporary
filesystem "
+ "(a ramdisk) mounted to <tt>[SITE]/tmp</tt>. In case
the mount is not "
+ "possible Check_MK starts without this temporary
filesystem.</p>"
+ "<p>Even if this is possible, it is not recommended to use
Check_MK this "
+ "way because it may reduce the overall performance of
Check_MK.</p>")
+
+
+ def is_relevant(self):
+ return True
+
+
+ def execute(self):
+ if self._tmpfs_mounted(config.omd_site()):
+ yield ACResultOK(_("The temporary filesystem is mounted"))
+ else:
+ yield ACResultWARN(_("The temporary filesystem is not mounted. Your
installation "
+ "may work with degraded performance."))
+
+
+ def _tmpfs_mounted(self, site_id):
+ # Borrowed from omd binary
+ #
+ # Problem here: if /omd is a symbolic link somewhere else,
+ # then in /proc/mounts the physical path will appear and be
+ # different from tmp_path. We just check the suffix therefore.
+ path_suffix = "sites/%s/tmp" % site_id
+ for line in file("/proc/mounts"):
+ try:
+ device, mp, fstype, options, dump, fsck = line.split()
+ if mp.endswith(path_suffix) and fstype == 'tmpfs':
+ return True
+ except:
+ continue
+ return False
+
+
+
class ACTestLDAPSecured(ACTest):
def category(self):
return ACTestCategories.security