Module: check_mk
Branch: master
Commit: 9c4826ddda6099e3402e4a5e3c2864e1862032f1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9c4826ddda6099…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 20 15:31:09 2016 +0100
4199 FIX Fix detection of replication mode if EC is distributed
If you use the new feature of having a distributed Event Console (consisting
of more than one Check_MK site) then the WATO display of the EC status
was broken. This has been fixed. WATO still shows only the status of
the local EC. This will be fixed in future.
Change-Id: Ife7d833e7ddcf65c8b1950a13c7235fe3e7a7a6e
---
.werks/4199 | 12 ++++++++++++
ChangeLog | 1 +
web/htdocs/mkeventd.py | 15 ++++++++++++++-
web/plugins/wato/mkeventd.py | 4 ++++
4 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/.werks/4199 b/.werks/4199
new file mode 100644
index 0000000..2a77e81
--- /dev/null
+++ b/.werks/4199
@@ -0,0 +1,12 @@
+Title: Fix detection of replication mode if EC is distributed
+Level: 1
+Component: ec
+Compatible: compat
+Version: 1.4.0i4
+Date: 1482244177
+Class: fix
+
+If you use the new feature of having a distributed Event Console (consisting
+of more than one Check_MK site) then the WATO display of the EC status
+was broken. This has been fixed. WATO still shows only the status of
+the local EC. This will be fixed in future.
diff --git a/ChangeLog b/ChangeLog
index 33ae80c..9b465a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -33,6 +33,7 @@
NOTE: Please refer to the migration notes!
* 4155 FIX: Do not perform actions on events if overflow limit is active...
* 4156 FIX: Fix off-by-one error in EC limit handling...
+ * 4199 FIX: Fix detection of replication mode if EC is distributed...
1.4.0i3:
diff --git a/web/htdocs/mkeventd.py b/web/htdocs/mkeventd.py
index 81b730a..d74e5c7 100644
--- a/web/htdocs/mkeventd.py
+++ b/web/htdocs/mkeventd.py
@@ -24,7 +24,7 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-import socket, config, re, time
+import socket, config, re, time, livestatus
import ast
import sites
@@ -183,6 +183,19 @@ def send_event(event):
return rfc
+def get_local_ec_status():
+ response = livestatus.LocalConnection().query("GET eventconsolestatus")
+ return dict(zip(response[0], response[1]))
+
+
+def replication_mode():
+ try:
+ status = get_local_ec_status()
+ return status["status_replication_slavemode"]
+ except livestatus.MKLivestatusSocketError:
+ return "stopped"
+
+
# Only use this for master/slave replication. For status queries use livestatus
def query_ec_directly(query):
try:
diff --git a/web/plugins/wato/mkeventd.py b/web/plugins/wato/mkeventd.py
index b111de1..78caf58 100644
--- a/web/plugins/wato/mkeventd.py
+++ b/web/plugins/wato/mkeventd.py
@@ -1061,6 +1061,7 @@ def mode_mkeventd_rule_packs(phase):
return
rep_mode = mkeventd.replication_mode()
+
if rep_mode in [ "sync", "takeover" ]:
copy_url = make_action_link([("mode", "mkeventd_rule_packs"),
("_copy_rules", "1")])
html.show_warning(_("WARNING: This Event Console is currently running as a
replication "
@@ -1070,6 +1071,9 @@ def mode_mkeventd_rule_packs(phase):
"the master into your local slave configuration: ") + \
'<a href="%s">' % copy_url + _("Copy Rules From
Master") + '</a>')
+ elif rep_mode == "stopped":
+ html.show_error(_("The Event Console is currently not running."))
+
# Simulator
event = show_event_simulator()