Module: check_mk
Branch: master
Commit: 28332240bf3d7f7ac5cc84821b847a5ae69f5623
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=28332240bf3d7f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Sat Sep 1 19:42:55 2018 +0200
Revert "5170 FIX Removed TMPFS config hook"
This reverts commit 8bbd16c4d130816fabcef373eaf7c22db86eb7fa.
Change-Id: I5bc8c05a810a6492517cb5308363fd4f5def96dc
---
omd/packages/omd/TMPFS.hook | 25 +++++++++++++++++++++++++
omd/packages/omd/omd | 13 +++++++++++++
2 files changed, 38 insertions(+)
diff --git a/omd/packages/omd/TMPFS.hook b/omd/packages/omd/TMPFS.hook
new file mode 100755
index 0000000..350221d
--- /dev/null
+++ b/omd/packages/omd/TMPFS.hook
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# Alias: Use a ramdisk for temporary files
+# Menu: Basic
+# This settings decides, wether this site uses a ramdisk for
+# temporary files. Using a ramdisk reduces disk IO produced
+# during monitoring dramatically. It is highly recommended to
+# leave this option enabled. Only disable this if you really
+# need to.
+
+case "$1" in
+ default)
+ echo "on"
+ ;;
+ choices)
+ echo "on: Use a ramdisk for temporary files"
+ echo "off: Do not use a ramdisk within this site"
+ ;;
+ set)
+ # Unmount the tmpfs when it was mounted before
+ if [ "$2" == "off" ]; then
+ omd umount
+ fi
+ ;;
+esac
diff --git a/omd/packages/omd/omd b/omd/packages/omd/omd
index 0a7f7ae..ede9538 100644
--- a/omd/packages/omd/omd
+++ b/omd/packages/omd/omd
@@ -1594,6 +1594,19 @@ def prepare_tmpfs(sitename, tmp):
if tmpfs_mounted(sitename):
return # Fine: Mounted
+ if g_site_conf["TMPFS"] != "on":
+ if os.path.exists(tmp):
+ return
+
+ sys.stdout.write("Preparing tmp directory %s..." % tmp)
+ sys.stdout.flush()
+ try:
+ os.mkdir(tmp)
+ except OSError, e:
+ if e.errno != errno.EEXIST: # File exists
+ raise
+ return
+
sys.stdout.write("Creating temporary filesystem %s..." % tmp)
sys.stdout.flush()
if not os.path.exists(tmp):