Module: check_mk
Branch: master
Commit: f3567c6cb009aaa7ea7fd8c8e8c019ba2f3c9f3c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f3567c6cb009aa…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Oct 26 15:42:42 2017 +0200
5439 FIX storcli_vdrives: Configured check state of related device state was not set
properly in some cases. Made that more robust.
Change-Id: Ic0512e7e571a34a5cd4e059c2511b2255c75892c
---
.werks/5439 | 11 +++++++++++
checks/storcli_vdrives | 16 ++++++++++------
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/.werks/5439 b/.werks/5439
new file mode 100644
index 0000000..80cd831
--- /dev/null
+++ b/.werks/5439
@@ -0,0 +1,11 @@
+Title: storcli_vdrives: Configured check state of related device state was not set
properly in some cases. Made that more robust.
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1509025127
+
+
diff --git a/checks/storcli_vdrives b/checks/storcli_vdrives
index c5d2886..596780e 100644
--- a/checks/storcli_vdrives
+++ b/checks/storcli_vdrives
@@ -36,11 +36,11 @@ factory_settings["storcli_vdrives_default_levels"] = {
def parse_storcli_vdrives(info):
raid_statenames = {
- "Optl" : "Optimal",
- "Pdgd" : "Partially Degraded",
+ "optl" : "Optimal",
+ "pdgd" : "Partially Degraded",
"dgrd" : "Degraded",
- "OfLn" : "Offline",
- "Rec" : "Recovery",
+ "ofln" : "Offline",
+ "rec" : "Recovery",
}
parsed = {}
@@ -53,7 +53,7 @@ def parse_storcli_vdrives(info):
item, raid_type, rawstate, access, consistent = line[:5]
parsed[item] = {
"raid_type" : raid_type,
- "state" : raid_statenames.get(rawstate, rawstate),
+ "state" : raid_statenames.get(rawstate.lower(),
rawstate),
"access" : access,
"consistent" : consistent,
}
@@ -81,7 +81,11 @@ def check_storcli_vdrives(item, params, parsed):
device_state = parsed[item]["state"]
infotext = "State is %s" % device_state
- status = params.get(device_state, 3)
+ if device_state in params:
+ status = params[device_state]
+ else:
+ status = 3
+ infotext += " (unknown[%s])" % device_state
yield status, infotext