[checkmk-commits] Check_MK Git: check_mk: FIX: fix event icon in case of using TCP access to EC

Mathias Kettner mk at mathias-kettner.de
Fri Nov 30 16:07:12 CET 2012


Module: check_mk
Branch: master
Commit: 1dd5a1e70717c4fcd1a67efd3cac1866a2df77ed
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1dd5a1e70717c4fcd1a67efd3cac1866a2df77ed

Author: Mathias Kettner <mk at mathias-kettner.de>
Date:   Fri Nov 30 16:07:09 2012 +0100

FIX: fix event icon in case of using TCP access to EC

---

 ChangeLog                              |    1 +
 mkeventd/web/plugins/icons/mkeventd.py |   21 +++++++++++++--------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4a46188..1bcdf66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -41,6 +41,7 @@
 
     Event Console:
     * FIX: fix exception in rules that use facility local7
+    * FIX: fix event icon in case of using TCP access to EC
     * Replication slave can now copy rules from master into local configuration
       via a new button in WATO.
     * Speedup access to event history by earlier filtering and prefiltering with grep
diff --git a/mkeventd/web/plugins/icons/mkeventd.py b/mkeventd/web/plugins/icons/mkeventd.py
index fff175f..9487d6b 100644
--- a/mkeventd/web/plugins/icons/mkeventd.py
+++ b/mkeventd/web/plugins/icons/mkeventd.py
@@ -45,18 +45,18 @@ def paint_mkeventd(what, row, tags, custom_vars):
     app  = None
 
     # Extract parameters from check_command:
-    args = command.split('!')[1].split(' ', 1)
+    args = command.split('!')[1].split()
     if not args:
         return
 
-    if len(args) >= 1:
-        # Handle -a and -H options. Sorry for the hack. We currently
-        # have no better idea
-        if args[0] == '-H':
-            args = args[2:] # skip two arguments
-        if args[0] == '-a':
-            args = args[1:]
+    # Handle -a and -H options. Sorry for the hack. We currently
+    # have no better idea
+    if len(args) >= 2 and args[0] == '-H':
+        args = args[2:] # skip two arguments
+    if len(args) >= 1 and args[0] == '-a':
+        args = args[1:]
 
+    if len(args) >= 1:
         if args[0] == '$HOSTNAME$':
             host = row['host_name']
         elif args[0] == '$HOSTADDRESS$':
@@ -64,6 +64,11 @@ def paint_mkeventd(what, row, tags, custom_vars):
         else:
             host = args[0]
 
+    # If we have no host then the command line from the check_command seems
+    # to be garbled. Better show nothing in this case.
+    if not host:
+        return
+
     # It is possible to have a central event console, this is the default case.
     # Another possible architecture is to have an event console in each site in
     # a distributed environment. For the later case the base url need to be



More information about the checkmk-commits mailing list