Module: check_mk
Branch: master
Commit: b02285f3f3ec001be5998d2218cab993fbe04065
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b02285f3f3ec00…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 6 14:29:24 2016 +0100
4132 Monitoring notifications: Add EC_ORIG_HOST to notifiation context
All notifications produced by the Event Console now add the variable EC_ORIG_HOST
to the notification context. The variable contains the original host information
of the event. Even when host rewriting is done, this contains the original name.
---
.werks/4132 | 11 +++++++++++
ChangeLog | 1 +
bin/mkeventd | 3 +++
3 files changed, 15 insertions(+)
diff --git a/.werks/4132 b/.werks/4132
new file mode 100644
index 0000000..1b3ee10
--- /dev/null
+++ b/.werks/4132
@@ -0,0 +1,11 @@
+Title: Monitoring notifications: Add EC_ORIG_HOST to notifiation context
+Level: 1
+Component: ec
+Compatible: compat
+Version: 1.4.0i3
+Date: 1481030875
+Class: feature
+
+All notifications produced by the Event Console now add the variable EC_ORIG_HOST
+to the notification context. The variable contains the original host information
+of the event. Even when host rewriting is done, this contains the original name.
diff --git a/ChangeLog b/ChangeLog
index e5c27fb..ecab0b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -94,6 +94,7 @@
* 3991 FIX: BI Aggregations: no longer show duplicate aggregations when an
aggregation has mulitple groups
Event Console:
+ * 4132 Monitoring notifications: Add EC_ORIG_HOST to notifiation context...
* 4097 FIX: Event console: Make writing of status file more robust...
Livestatus:
diff --git a/bin/mkeventd b/bin/mkeventd
index 7203a1e..1cf41cf 100755
--- a/bin/mkeventd
+++ b/bin/mkeventd
@@ -2371,6 +2371,7 @@ class EventServer:
if "set_text" in rule:
event["text"] = replace_groups(rule["set_text"],
event["text"], groups)
if "set_host" in rule:
+ event["orig_host"] = event["host"]
event["host"] = replace_groups(rule["set_host"],
event["host"], groups)
if "set_application" in rule:
event["application"] =
replace_groups(rule["set_application"], event["application"], groups)
@@ -3938,6 +3939,8 @@ def do_notify(event, username=None, is_cancelling=False):
"EC_PID": str(event.get("pid", 0)),
"EC_MATCH_GROUPS":
"\t".join(event["match_groups"]),
"EC_CONTACT_GROUPS": contact_groups and "
".join(contact_groups) or "",
+ "EC_ORIG_HOST": event.get("orig_host",
event["host"]),
+
}
# Add rule based notification specific macros and add the