Module: check_mk
Branch: master
Commit: 37b8b9d79e1317b17216e25c07b725d2bddd8e82
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=37b8b9d79e1317…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jun 14 10:11:25 2013 +0200
EC: better detect non-IP-number hosts in hostname translation
---
ChangeLog | 1 +
mkeventd/bin/mkeventd | 9 +++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1d17326..3daa9f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -41,6 +41,7 @@
* New global setting "force message archiving", converts the EC into
a kind of syslog archive
* FIX: fix layout of filter for history action type
+ * FIX: better detect non-IP-number hosts in hostname translation
1.2.3i1:
Core:
diff --git a/mkeventd/bin/mkeventd b/mkeventd/bin/mkeventd
index 37a3ff2..3d63bd9 100755
--- a/mkeventd/bin/mkeventd
+++ b/mkeventd/bin/mkeventd
@@ -1556,8 +1556,13 @@ class EventServer:
backedhost = backedhost.lower()
# 2. Drop domain part (not applied to IP addresses!)
- if translation.get("drop_domain") and backedhost and not
backedhost[0].isdigit():
- backedhost = backedhost.split(".", 1)[0]
+ if translation.get("drop_domain") and backedhost:
+ # only apply if first part does not convert successfully into an int
+ firstpart = backedhost.split(".", 1)[0]
+ try:
+ int(firstpart)
+ except:
+ backedhost = firstpart
# 3. Regular expression conversion
if "regex" in translation: