[checkmk-commits] Check_MK Git: check_mk: simplified ibm_svc_mdisk check

Andreas Boesl ab at mathias-kettner.de
Fri Feb 20 17:07:34 CET 2015


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

Author: Andreas Boesl <ab at mathias-kettner.de>
Date:   Fri Feb 20 17:07:17 2015 +0100

simplified ibm_svc_mdisk check

---

 checks/ibm_svc_mdisk |   30 ++----------------------------
 1 file changed, 2 insertions(+), 28 deletions(-)

diff --git a/checks/ibm_svc_mdisk b/checks/ibm_svc_mdisk
index e3b2da7..4f2cc73 100644
--- a/checks/ibm_svc_mdisk
+++ b/checks/ibm_svc_mdisk
@@ -59,35 +59,9 @@ def check_ibm_svc_mdisk(item, params, info):
             mdisk_status = line[2]
             mdisk_mode = line[3]
 
-            if mdisk_status == "online":
-                if 'online_state' in params:
-                    yield params['online_state'], "Status: %s" % mdisk_status
-            elif mdisk_status == "degraded":
-                if 'degraded_state' in params:
-                    yield params['degraded_state'], "Status: %s" % mdisk_status
-            elif mdisk_status == "offline":
-                if 'offline_state' in params:
-                    yield params['offline_state'], "Status: %s" % mdisk_status
-            elif mdisk_status == "excluded":
-                if 'excluded_state' in params:
-                    yield params['excluded_state'], "Status: %s" % mdisk_status
-            else:
-                yield 1, "Status: %s" % mdisk_status
+            yield params.get("%s_state" % mdisk_status, 1), "Status: %s" % mdisk_status
+            yield params.get("%s_mode" % mdisk_mode, 1),    "Mode: %s" % mdisk_status
 
-            if mdisk_mode == "managed":
-                if 'managed_mode' in params:
-                    yield params['managed_mode'], "Mode: %s" % mdisk_mode
-            elif mdisk_mode == "array":
-                if 'array_mode' in params:
-                    yield params['array_mode'], "Mode: %s" % mdisk_mode
-            elif mdisk_mode == "image":
-                if 'image_mode' in params:
-                    yield params['image_mode'], "Mode: %s" % mdisk_mode
-            elif mdisk_mode == "unmanaged":
-                if 'unmanaged_mode' in params:
-                    yield params['unmanaged_mode'], "Mode: %s" % mdisk_mode
-            else:
-                yield 1, "Mode: %s" % mdisk_mode
 
 check_info["ibm_svc_mdisk"] = {
     "check_function"          : check_ibm_svc_mdisk,



More information about the checkmk-commits mailing list