Module: check_mk
Branch: master
Commit: dd87f7a6382dfe5f67d9e2e70fa274105ad33612
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dd87f7a6382dfe…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 20 16:21:30 2016 +0100
4201 mkeventd_status: avoid duplicate averaging, make graphs more precise in time resolution
By not using pre-averaged values anymore but switching to precise performance counters
the check now computes are precise average of the counted events (e.g. rule hits)
since the last check. This makes the graphs much more precise. It also makes a
reschedule of the check show more recent data.
Change-Id: I12a891fa4dc5956371b44fd074d5197c0ea68799
---
.werks/4201 | 12 ++++++++++++
ChangeLog | 1 +
checks/mkeventd_status | 16 ++++++++++------
3 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/.werks/4201 b/.werks/4201
new file mode 100644
index 0000000..e002ee0
--- /dev/null
+++ b/.werks/4201
@@ -0,0 +1,12 @@
+Title: mkeventd_status: avoid duplicate averaging, make graphs more precise in time resolution
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i4
+Date: 1482247182
+Class: feature
+
+By not using pre-averaged values anymore but switching to precise performance counters
+the check now computes are precise average of the counted events (e.g. rule hits)
+since the last check. This makes the graphs much more precise. It also makes a
+reschedule of the check show more recent data.
diff --git a/ChangeLog b/ChangeLog
index 07d2601..10af144 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@
* 4198 mkeventd_status: rework graph templates, only group metrics where it makes sense'
* 4005 agent_activemq: now able to provide BasicAuth credentials...
NOTE: Please refer to the migration notes!
+ * 4201 mkeventd_status: avoid duplicate averaging, make graphs more precise in time resolution...
* 4171 FIX: perle_psmu: fixed value error...
* 4172 FIX: smart.temp: fixed discovery and check function...
* 4173 FIX: if.include: ignore some more keys in 'Network interfaces and switch ports' rule which are only used for interface grouping
diff --git a/checks/mkeventd_status b/checks/mkeventd_status
index 9822e7c..ef428ac 100644
--- a/checks/mkeventd_status
+++ b/checks/mkeventd_status
@@ -104,17 +104,21 @@ def check_mkeventd_status(item, params, parsed):
("Created events", "event", "%.2f/s"),
("Client connects", "connect", "%.2f/s"),
]
+ rates = {}
+ print status.keys()
+ this_time = time.time()
for title, col, fmt in columns:
- value = status["average_%s_rate" % col]
- yield 0, ("%s: " + fmt) % (title, value), \
- [("average_%s_rate" % col, value)]
+ counter_value = status[col + "s"]
+ rate = get_rate(col, this_time, counter_value)
+ rates[col] = rate
+ yield 0, ("%s: " + fmt) % (title, rate), \
+ [("average_%s_rate" % col, rate)]
# Hit rate
- if status["average_rule_trie_rate"] == 0.0:
+ if rates["rule_trie"] == 0.0:
hit_rate_txt = "-"
else:
- value = status["average_rule_hit_rate"] \
- / status["average_rule_trie_rate"] * 100
+ value = rates["rule_hit"] / rates["rule_trie"] * 100
hit_rate_txt = "%.2f%%" % value
yield 0, None, [("average_rule_hit_ratio", value)]
yield 0, "%s: %s" % ("Rule hit ratio", hit_rate_txt)
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()