[checkmk-commits] Check_MK Git: check_mk: Fixed TypeError in check ibm_svc_host

Sven Rueß sr at mathias-kettner.de
Tue Feb 17 14:49:27 CET 2015


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

Author: Sven Rueß <sr at mathias-kettner.de>
Date:   Tue Feb 17 14:49:14 2015 +0100

Fixed TypeError in check ibm_svc_host

---

 checks/ibm_svc_host                  |    8 +++++++-
 web/plugins/wato/check_parameters.py |   17 +++++++++++------
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/checks/ibm_svc_host b/checks/ibm_svc_host
index 4f3cb5b..01121f4 100644
--- a/checks/ibm_svc_host
+++ b/checks/ibm_svc_host
@@ -32,7 +32,7 @@
 # 3:host106:2:2:online
 
 def inventory_ibm_svc_host(info):
-    return [(None, None)]
+    return [(None, {})]
 
 def check_ibm_svc_host(item, params, info):
     degraded = 0
@@ -41,6 +41,11 @@ def check_ibm_svc_host(item, params, info):
     inactive = 0
     other    = 0
 
+    if params == None:
+        # Old inventory rule until version 1.2.7
+        # params were None instead of empty dictionary
+        params = { 'always_ok': False }
+
     for line in info:
         if line[4] == 'degraded':
             degraded += 1
@@ -102,3 +107,4 @@ check_info["ibm_svc_host"] = {
     "has_perfdata"          : True,
     "group"                 : "ibm_svc_host",
 }
+
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 44a8e60..8149482 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -4651,6 +4651,11 @@ register_check_parameters(
 )
 
 def transform_ibm_svc_host(params):
+    if params == None:
+        # Old inventory rule until version 1.2.7
+        # params were None instead of emtpy dictionary
+        params = { 'always_ok': False }
+
     if 'always_ok' in params:
         if params['always_ok'] == False:
             params = { 'degraded_hosts': (1,1), 'offline_hosts': (1,1), 'other_hosts': (1,1) }
@@ -4661,13 +4666,13 @@ def transform_ibm_svc_host(params):
 register_check_parameters(
     subgroup_storage,
     "ibm_svc_host",
-    _("IBM SVC: Options for SVC Hosts Check "),
+    _("IBM SVC: Options for SVC Hosts Check"),
     Transform(
         Dictionary(
             elements = [
                 ( "active_hosts",
                     Tuple(
-                        title = _("Absolute amount of active hosts"),
+                        title = _("Count of active hosts"),
                         elements = [
                             Integer(title = _("Warning at or below"), minvalue = 0, unit = _("active hosts")),
                             Integer(title = _("Critical at or below"), minvalue = 0, unit = _("active hosts")),
@@ -4676,7 +4681,7 @@ register_check_parameters(
                 ),
                 ( "inactive_hosts",
                     Tuple(
-                        title = _("Absolute amount of inactive hosts"),
+                        title = _("Count of inactive hosts"),
                         elements = [
                             Integer(title = _("Warning at or above"), minvalue = 0, unit = _("inactive hosts")),
                             Integer(title = _("Critical at or above"), minvalue = 0, unit = _("inactive hosts")),
@@ -4685,7 +4690,7 @@ register_check_parameters(
                 ),
                 ( "degraded_hosts",
                     Tuple(
-                        title = _("Absolute amount of degraded hosts"),
+                        title = _("Count of degraded hosts"),
                         elements = [
                             Integer(title = _("Warning at or above"), minvalue = 0, unit = _("degraded hosts")),
                             Integer(title = _("Critical at or above"), minvalue = 0, unit = _("degraded hosts")),
@@ -4694,7 +4699,7 @@ register_check_parameters(
                 ),
                 ( "offline_hosts",
                     Tuple(
-                        title = _("Absolute amount of offline hosts"),
+                        title = _("Count of offline hosts"),
                         elements = [
                             Integer(title = _("Warning at or above"), minvalue = 0, unit = _("offline hosts")),
                             Integer(title = _("Critical at or above"), minvalue = 0, unit = _("offline hosts")),
@@ -4703,7 +4708,7 @@ register_check_parameters(
                 ),
                 ( "other_hosts",
                     Tuple(
-                        title = _("Absolute amount of other hosts"),
+                        title = _("Count of other hosts"),
                         elements = [
                             Integer(title = _("Warning at or above"), minvalue = 0, unit = _("other hosts")),
                             Integer(title = _("Critical at or above"), minvalue = 0, unit = _("other hosts")),



More information about the checkmk-commits mailing list