[checkmk-commits] Check_MK Git: check_mk: hitachi_hus_dkc, hitachi_hus_dku: small changes to criteria for states

Goetz Golla gg at mathias-kettner.de
Thu Apr 16 12:15:10 CEST 2015


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

Author: Goetz Golla <gg at mathias-kettner.de>
Date:   Thu Apr 16 12:14:20 2015 +0200

hitachi_hus_dkc, hitachi_hus_dku: small changes to criteria for states

---

 checkman/hitachi_hus_dkc |    7 ++++---
 checkman/hitachi_hus_dku |    8 +++++---
 checks/hitachi_hus_dkc   |   25 ++++++++++++++-----------
 checks/hitachi_hus_dku   |   15 +++++++++------
 4 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/checkman/hitachi_hus_dkc b/checkman/hitachi_hus_dkc
index 51443ad..dc22290 100644
--- a/checkman/hitachi_hus_dkc
+++ b/checkman/hitachi_hus_dkc
@@ -12,9 +12,10 @@ description:
  Processor, Internal Bus, Cache, Shared Memory, Power Supply, Battery,
  Fan, Environment.
 
- The checks gets CRIT if one of the components is not in the state "noError".
- In addition, the Environment component is also OK, when it is in the state
- "moderate".
+ The check is {OK} if all of the components are in the state "noError".
+ It is {WARN} if some of the components are in the states "moderate" or
+ "service".  It is {CRIT} if some of the components are in other states as
+ the above-mentioned.
 
 inventory:
  One item for every DKC chassis found
diff --git a/checkman/hitachi_hus_dku b/checkman/hitachi_hus_dku
index 38a9a52..ec1a3e2 100644
--- a/checkman/hitachi_hus_dku
+++ b/checkman/hitachi_hus_dku
@@ -10,9 +10,11 @@ description:
  extract state information of the following hardware components of the DKU:
  Power Supply, Drive, Fan, Environment.
 
- The checks gets CRIT if one of the components is not in the state "noError".
- In addition, the Environment component is also OK, when it is in the state
- "moderate".
+ The check is {OK} if all of the components are in the state "noError".
+ It is {WARN} if some of the components are in the states "moderate" or
+ "service".  It is {CRIT} if some of the components are in other states as
+ the above-mentioned.
+
 
 inventory:
  One service for every DKU chassis found
diff --git a/checks/hitachi_hus_dkc b/checks/hitachi_hus_dkc
index 727b7b6..5cfac6f 100644
--- a/checks/hitachi_hus_dkc
+++ b/checks/hitachi_hus_dkc
@@ -31,16 +31,16 @@ def inventory_hitachi_hus_dkc(info):
         yield line[0], None
 
 def check_hitachi_hus_dkc(item, _no_params, info):
-    # table of end-OIDs, monitored entities and OK states
+    # table of end-OIDs, monitored entities and OK/Warn states
     component_map = {
-        2: ("Processor",     (1, )  ),
-        3: ("Internal Bus",  (1, )  ),
-        4: ("Cache",         (1, )  ),
-        5: ("Shared Memory", (1, )  ),
-        6: ("Power Supply",  (1, )  ),
-        7: ("Battery",       (1, )  ),
-        8: ("Fan",           (1, )  ),
-        9: ("Environment",   (1, 4) ),
+        2: ("Processor",     (1, ), (4, 5) ),
+        3: ("Internal Bus",  (1, ), (4, 5) ),
+        4: ("Cache",         (1, ), (4, 5) ),
+        5: ("Shared Memory", (1, ), (4, 5) ),
+        6: ("Power Supply",  (1, ), (4, 5) ),
+        7: ("Battery",       (1, ), (4, 5) ),
+        8: ("Fan",           (1, ), (4, 5) ),
+        9: ("Environment",   (1, ), (4, 5) ),
     }
     error_list = [
         "unknown",
@@ -55,9 +55,12 @@ def check_hitachi_hus_dkc(item, _no_params, info):
         if line[0] == item:
             infotext = ""
             errors = False
-            for end_oid, (component, ok_states) in component_map.iteritems():
+            for end_oid, (component, ok_states, warn_states) in component_map.iteritems():
                 severity = int(line[end_oid - 1])
-                if severity not in ok_states:
+                if severity in warn_states:
+                    errors = True
+                    yield 1, "%s has errors of severity \"%s\"" % (component, error_list[severity])
+                elif severity not in ok_states:
                     errors = True
                     yield 2, "%s has errors of severity \"%s\"" % (component, error_list[severity])
             if not errors:
diff --git a/checks/hitachi_hus_dku b/checks/hitachi_hus_dku
index a766096..ba15a7b 100644
--- a/checks/hitachi_hus_dku
+++ b/checks/hitachi_hus_dku
@@ -33,10 +33,10 @@ def inventory_hitachi_hus_dku(info):
 def check_hitachi_hus_dku(item, _no_params, info):
     # table of end-OIDs, monitored components and OK states
     component_map = {
-        2: ("Power Supply", (1,)    ),
-        3: ("Fan",          (1,)    ),
-        4: ("Environment",  (1, 4,) ),
-        5: ("Drive",        (1,)    ),
+        2: ("Power Supply", (1,), (4, 5) ),
+        3: ("Fan",          (1,), (4, 5) ),
+        4: ("Environment",  (1,), (4, 5) ),
+        5: ("Drive",        (1,), (4, 5) ),
     }
     error_list = [
         "unknown",
@@ -51,9 +51,12 @@ def check_hitachi_hus_dku(item, _no_params, info):
         if line[0] == item:
             infotext = ""
             errors = False
-            for end_oid, (component, ok_states) in component_map.iteritems():
+            for end_oid, (component, ok_states, warn_states) in component_map.iteritems():
                 severity = int(line[end_oid - 1])
-                if severity not in ok_states:
+                if severity in warn_states:
+                    errors = True
+                    yield 1, "%s has errors of severity \"%s\"" % (component, error_list[severity])
+                elif severity not in ok_states:
                     errors = True
                     yield 2, "%s has errors of severity \"%s\"" % (component, error_list[severity])
             if not errors:



More information about the checkmk-commits mailing list