[checkmk-commits] Check_MK Git: check_mk: ibm_svc_portsas: Check checks agains the portstate on discovery

Bastian Kuhn bk at mathias-kettner.de
Fri Feb 6 12:46:51 CET 2015


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

Author: Bastian Kuhn <bk at mathias-kettner.de>
Date:   Fri Feb  6 12:46:41 2015 +0100

ibm_svc_portsas: Check checks agains the portstate on discovery

---

 checkman/ibm_svc_portsas |    2 +-
 checks/ibm_svc_portsas   |    8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/checkman/ibm_svc_portsas b/checkman/ibm_svc_portsas
index ffca097..ff4e1d8 100644
--- a/checkman/ibm_svc_portsas
+++ b/checkman/ibm_svc_portsas
@@ -7,7 +7,7 @@ description:
  Checks the status of SAS Ports in an IBM SVC / Storwize V3700 / V7000
  device.
 
- Status {online} is {OK}, every other status is {CRIT}.
+ Every Status Change after Discovery results in a {CRIT} state.
 
  Please note: You need the Special Agent agent_ibmsvc to retrieve the monitoring
  data from the device. Your monitoring user must be able to SSH to the device
diff --git a/checks/ibm_svc_portsas b/checks/ibm_svc_portsas
index b4b1b70..e3fe838 100644
--- a/checks/ibm_svc_portsas
+++ b/checks/ibm_svc_portsas
@@ -28,9 +28,11 @@
 def inventory_ibm_svc_portsas(info):
     for line in info:
         if len(line) in (10, 12) and line[6] != "offline_unconfigured":
-            yield line[0], None
+            yield line[0], {'current_state' : line[6]}
 
-def check_ibm_svc_portsas(item, _no_params, info):
+def check_ibm_svc_portsas(item, params, info):
+    if not params:
+        params = { 'current_state' : 'offline' }
     for line in info:
         if len(line) in (10, 12) and line[0] == item:
             sasport_status = line[6]
@@ -38,7 +40,7 @@ def check_ibm_svc_portsas(item, _no_params, info):
             sasport_type = line[9]
 
             infotext = "Status: %s" % sasport_status
-            if sasport_status == "online":
+            if sasport_status == params['current_state']:
                 state = 0
             else:
                 state = 2



More information about the checkmk-commits mailing list