Module: check_mk
Branch: master
Commit: a2b9f6bce9c2ce857d7a68e1698bab0766bbea78
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a2b9f6bce9c2ce…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Feb 6 08:44:34 2013 +0100
WATO: Added hook to make the mkeventd reload in distributed WATO setups during
"activate changes" process
---
ChangeLog | 2 ++
mkeventd/web/plugins/wato/mkeventd.py | 20 +++++++++++++++-----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a242c02..a9548df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -61,6 +61,8 @@
* Speed up rule matches in some special cases by factor of 100 and more
* Init-Script: Improved handling of stale pidfiles
* Init-Script: Detecting and reporting already running processes
+ * WATO: Added hook to make the mkeventd reload in distributed WATO setups
+ during "activate changes" process
1.2.1i5:
Core:
diff --git a/mkeventd/web/plugins/wato/mkeventd.py
b/mkeventd/web/plugins/wato/mkeventd.py
index 3cfe729..8c13832 100644
--- a/mkeventd/web/plugins/wato/mkeventd.py
+++ b/mkeventd/web/plugins/wato/mkeventd.py
@@ -1078,6 +1078,14 @@ def mode_mkeventd_edit_rule(phase):
html.hidden_fields()
html.end_form()
+def mkeventd_reload():
+ mkeventd.query("COMMAND RELOAD")
+ try:
+ os.remove(log_dir + "mkeventd.log")
+ except OSError:
+ pass # ignore not existing logfile
+ log_audit(None, "mkeventd-activate", _("Activated changes of event
console configuration"))
+
def mode_mkeventd_changes(phase):
if phase == "title":
return _("Event Console - Pending Changes")
@@ -1088,14 +1096,12 @@ def mode_mkeventd_changes(phase):
if config.may("mkeventd.activate") and
parse_audit_log("mkeventd") and mkeventd.daemon_running():
html.context_button(_("Activate Changes!"),
html.makeactionuri([("_activate", "now")]),
"apply", hot=True)
-
+
elif phase == "action":
if html.check_transaction():
- mkeventd.query("COMMAND RELOAD")
- os.remove(log_dir + "mkeventd.log")
- log_audit(None, "mkeventd-activate", _("Activated changes of
event console configuration"))
+ mkeventd_reload()
return "mkeventd_rules", _("Changes successfully
activated.")
-
+
else:
if not mkeventd.daemon_running():
warning = _("The Event Console Daemon is currently not running. ")
@@ -1864,3 +1870,7 @@ define command {
api.register_hook("pre-activate-changes",
mkeventd_update_notifiation_configuration)
+# Only register the reload hook when mkeventd is enabled
+if mkeventd_enabled:
+ api.register_hook("activate-changes", lambda hosts: mkeventd_reload())
+