Module: check_mk
Branch: master
Commit: 3d80556c0d3aeca66ad0ab4e7f4adc826b3149dc
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3d80556c0d3aec…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Dec 3 16:47:33 2014 +0100
#1610 FIX Hostname translation now also works for incoming SNMP traps
---
.werks/1610 | 9 +++++++++
ChangeLog | 1 +
mkeventd/bin/mkeventd | 15 +++++++++------
3 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/.werks/1610 b/.werks/1610
new file mode 100644
index 0000000..d22d031
--- /dev/null
+++ b/.werks/1610
@@ -0,0 +1,9 @@
+Title: Hostname translation now also works for incoming SNMP traps
+Level: 1
+Component: ec
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417621627
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 001a255..5ee9eae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -154,6 +154,7 @@
Event Console:
* 1169 Added host state type filter to "recent event history" view
* 1531 FIX: Fixed exception in event history view when displaying CHANGESTATE events
+ * 1610 FIX: Hostname translation now also works for incoming SNMP traps
HW/SW-Inventory:
* 1479 liveproxyd: new function for collecting remote inventory data...
diff --git a/mkeventd/bin/mkeventd b/mkeventd/bin/mkeventd
index e1c294b..8e8a53c 100755
--- a/mkeventd/bin/mkeventd
+++ b/mkeventd/bin/mkeventd
@@ -1172,6 +1172,7 @@ class EventServer:
'application' : application.replace('\n', ''),
'text' : text
}
+ self.do_translate_hostname(event)
self.process_event(event)
def serve(self):
@@ -2022,6 +2023,13 @@ class EventServer:
return backedhost
+ def do_translate_hostname(self, event):
+ try:
+ event["host"] = self.translate_hostname(event["host"])
+ except Exception, e:
+ if g_config["debug_rules"]:
+ log('Unable to parse host "%s" (%s)' %
(event.get("host"), e))
+ event["host"] = ""
def parse_event(self, line, address):
event = {}
@@ -2130,12 +2138,7 @@ class EventServer:
"time" : time.time(),
}
- try:
- event["host"] = self.translate_hostname(event["host"])
- except Exception, e:
- if g_config["debug_rules"]:
- log('Unable to parse host "%s" (%s)' %
(event.get("host"), e))
- event["host"] = ""
+ self.do_translate_hostname(event)
if g_config["debug_rules"]:
log('Parsed message:\n' +