Module: check_mk
Branch: master
Commit: 9be64ca62837d6c28408e643956e35be9b01e671
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9be64ca62837d6…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Jun 9 12:05:20 2015 +0200
#2326 Allow relating Event Console hosts to monitoring hosts now also by alias
In the view of the Event Console events in the GUI Check_MK tries to match the
hosts of the events with the hosts in the monitoring (if they are known) by
either the host name or the IP address. From now on also the hosts' aliases
are being checked.
---
.werks/2326 | 12 ++++++++++++
ChangeLog | 1 +
mkeventd/web/plugins/views/mkeventd.py | 15 +++++++++++----
3 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/.werks/2326 b/.werks/2326
new file mode 100644
index 0000000..f634427
--- /dev/null
+++ b/.werks/2326
@@ -0,0 +1,12 @@
+Title: Allow relating Event Console hosts to monitoring hosts now also by alias
+Level: 1
+Component: ec
+Compatible: compat
+Version: 1.2.7i2
+Date: 1433844223
+Class: feature
+
+In the view of the Event Console events in the GUI Check_MK tries to match the
+hosts of the events with the hosts in the monitoring (if they are known) by
+either the host name or the IP address. From now on also the hosts' aliases
+are being checked.
diff --git a/ChangeLog b/ChangeLog
index b28d9be..98a253e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -34,6 +34,7 @@
Event Console:
* 2333 The Event Console log level can now be configured via GUI...
* 2334 Logging details about loaded SNMP MIB modules during startup
+ * 2326 Allow relating Event Console hosts to monitoring hosts now also by alias...
1.2.7i1:
diff --git a/mkeventd/web/plugins/views/mkeventd.py
b/mkeventd/web/plugins/views/mkeventd.py
index 7afca6c..37f9e39 100644
--- a/mkeventd/web/plugins/views/mkeventd.py
+++ b/mkeventd/web/plugins/views/mkeventd.py
@@ -72,16 +72,21 @@ def table_events(what, columns, add_headers, only_sites, limit,
filters):
# the host_address.
host_filters = ""
for host in required_hosts:
+ host_utf8 = host.encode("utf-8")
host_filters += "Filter: host_name =~ %s\n" \
- "Filter: host_address = %s\n" %
(host.encode("utf-8"), host.encode("utf-8"))
+ "Filter: host_alias =~ %s\n" \
+ "Filter: host_address = %s\n" % \
+ (host_utf8, host_utf8, host_utf8)
if len(required_hosts) > 0:
- host_filters += "Or: %d\n" % (len(required_hosts) * 2)
+ host_filters += "Or: %d\n" % (len(required_hosts) * 3)
# Make sure that the host name is fetched. We need it for
# joining. The event columns are always fetched all. The event
# daemon currently does not implement any Columns: header.
if "host_name" not in columns:
columns.append("host_name")
+ if "host_alias" not in columns:
+ columns.append("host_alias")
if "host_address" not in columns:
columns.append("host_address")
@@ -124,11 +129,12 @@ def table_events(what, columns, add_headers, only_sites, limit,
filters):
else:
host_contact_groups = None
- # Create lookup dict from hostname/address to the dataset of the host.
+ # Create lookup dict from hostname/alias/address to the dataset of the host.
# This speeds up the mapping to the events.
hostdict = {}
for row in hostrows:
hostdict[row["host_name"].lower()] = row
+ hostdict[row["host_alias"].lower()] = row
hostdict[row["host_address"]] = row
# If there is at least one host filter, then we do not show event
@@ -928,7 +934,8 @@ if mkeventd_enabled:
('event_state', None, ''),
('event_host', None, ''),
('event_ipaddress', None, ''),
- ('host_address', 'hoststatus', ''),
+ ('foobar', None, ''),
+ ('alias', 'hoststatus', ''),
('host_contacts', None, ''),
('host_icons', None, ''),
('event_text', None, ''),