Module: check_mk
Branch: master
Commit: ddecc52a8aa30e945afe3b3fef4d8aa6fe759d90
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ddecc52a8aa30e…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Oct 21 10:29:43 2015 +0200
fixed broken I/O calculation in hp_msa I/O checks
---
checks/hp_msa.include | 32 +++++++++++++++++++-------------
checks/hp_msa_fan | 17 +++++++++--------
checks/hp_msa_volume | 24 ++++++++++++++++--------
3 files changed, 44 insertions(+), 29 deletions(-)
diff --git a/checks/hp_msa.include b/checks/hp_msa.include
index 9c2bb59..247ecc4 100644
--- a/checks/hp_msa.include
+++ b/checks/hp_msa.include
@@ -25,14 +25,14 @@
# Boston, MA 02110-1301 USA.
hp_msa_state_map = {
- "Up" : 0,
- "OK" : 0,
- "Warning" : 1,
- "Degraded" : 1,
- "Error" : 2,
- "Not Present" : 2,
- "Fault" : 2,
- "Unknown" : 3,
+ "Up" : (0, "up"),
+ "OK" : (0, "OK"),
+ "Warning" : (1, "warning"),
+ "Degraded" : (1, "degraded"),
+ "Error" : (2, "error"),
+ "Not Present" : (2, "not present"),
+ "Fault" : (2, "fault"),
+ "Unknown" : (3, "unknown"),
}
@@ -46,9 +46,16 @@ def parse_hp_msa(info):
info_enrolment[item_id][line[2]] = " ".join(line[3:])
parsed = {}
+ now = time.time()
for key, values in info_enrolment.items():
item_name = values.get("location", key).replace("- ",
"")
item_name = (item_name.rsplit("_", 1)[-1]).strip()
+ if values.get("data-read-numeric", ""):
+ values["data-read-numeric"] = \
+ get_rate("%s_read" % item_name, now,
int(values["data-read-numeric"]))
+ if values.get("data-written-numeric", ""):
+ values["data-written-numeric"] = \
+ get_rate("%s_write" % item_name, now,
int(values["data-written-numeric"]))
parsed[item_name] = values
return parsed
@@ -61,8 +68,8 @@ def inventory_hp_msa_health(parsed):
def check_hp_msa_health(item, _no_params, parsed):
if item in parsed:
infotexts = []
- health_state = hp_msa_state_map[parsed[item]["health"]]
- health_info = "Status: %s" % parsed[item]["health"]
+ health_state, health_state_readable =
hp_msa_state_map[parsed[item]["health"]]
+ health_info = "Status: %s" % health_state_readable
if health_state and parsed[item].get("health-reason", ""):
health_info += " (%s)" % parsed[item]["health-reason"]
@@ -96,10 +103,9 @@ def inventory_hp_msa_io(parsed):
def check_hp_msa_io(item, params, parsed):
disks = {}
for key, values in parsed.items():
- now = time.time()
disks[key] = {
- "read_throughput" : get_rate("%s_read" % key, now,
int(values["data-read-numeric"])),
- "write_throughput" : get_rate("%s_write" % key, now,
int(values["data-written-numeric"])),
+ "read_throughput" : values["data-read-numeric"],
+ "write_throughput" : values["data-written-numeric"],
}
return check_diskstat_dict(item, params, disks)
diff --git a/checks/hp_msa_fan b/checks/hp_msa_fan
index d5ab434..29f772f 100644
--- a/checks/hp_msa_fan
+++ b/checks/hp_msa_fan
@@ -63,17 +63,18 @@ def inventory_hp_msa_fan(parsed):
def check_hp_msa_fan(item, params, parsed):
if item in parsed:
- fan_status = parsed[item]["status"]
- fan_speed = int(parsed[item]["speed"])
- fan_health = parsed[item]["health"]
+ fan_speed = int(parsed[item]["speed"])
+ fan_state, fan_state_readable = \
+ hp_msa_state_map[parsed[item]["status"]]
+ fan_health_state, fan_health_state_readable = \
+ hp_msa_state_map[parsed[item]["health"]]
fan_health_reason = parsed[item].get("health-reason", "")
- yield hp_msa_state_map[fan_status], \
- "Status: %s, speed: %s RPM" % (fan_status, fan_speed)
+ yield fan_state, "Status: %s, speed: %s RPM" % (fan_state_readable,
fan_speed)
- if hp_msa_state_map[fan_health] > 0 and fan_health_reason:
- yield hp_msa_state_map[fan_health], "health: %s (%s)" % \
- (fan_health, fan_health_reason)
+ if fan_health_state > 0 and fan_health_reason:
+ yield fan_health_state, "health: %s (%s)" % \
+ (fan_health_state_readable, fan_health_reason)
check_info['hp_msa_fan'] = {
diff --git a/checks/hp_msa_volume b/checks/hp_msa_volume
index 893ce8a..26b9134 100644
--- a/checks/hp_msa_volume
+++ b/checks/hp_msa_volume
@@ -134,8 +134,10 @@
# | main check |
# '----------------------------------------------------------------------'
+
def parse_hp_msa_volume(info):
parsed = {}
+ now = time.time()
for line in info:
if line[0] == "volumes":
if line[2] == "durable-id":
@@ -149,8 +151,14 @@ def parse_hp_msa_volume(info):
else:
for key, values in parsed.items():
if volume_name == values["volume-name"]:
- parsed[key][line[2]] = " ".join(line[3:])
-
+ if line[2] == "data-read-numeric":
+ parsed[key][line[2]] = \
+ get_rate("%s_read" % key, now, int(line[3]))
+ elif line[2] == "data-written-numeric":
+ parsed[key][line[2]] = \
+ get_rate("%s_write" % key, now, int(line[3]))
+ else:
+ parsed[key][line[2]] = " ".join(line[3:])
return parsed
@@ -162,6 +170,7 @@ check_info['hp_msa_volume'] = {
'includes' : [ "hp_msa.include" ],
}
+
#.
# .--volume df-----------------------------------------------------------.
# | _ _ __ |
@@ -172,6 +181,7 @@ check_info['hp_msa_volume'] = {
# | |
# +----------------------------------------------------------------------+
+
def inventory_hp_msa_volume_df(parsed):
for key in parsed.keys():
yield key, {}
@@ -198,6 +208,7 @@ check_info['hp_msa_volume.df'] = {
'includes' : [ "hp_msa.include",
"df.include" ],
}
+
#.
# .--volume IO-----------------------------------------------------------.
# | _ ___ ___ |
@@ -208,13 +219,13 @@ check_info['hp_msa_volume.df'] = {
# | |
# '----------------------------------------------------------------------'
+
def check_hp_msa_volume_io(item, params, parsed):
disks = {}
for key, values in parsed.items():
- now = time.time()
disks[key] = {
- "read_throughput" : get_rate("%s_read" % key, now,
int(values["data-read-numeric"])),
- "write_throughput" : get_rate("%s_write" % key, now,
int(values["data-written-numeric"])),
+ "read_throughput" : values["data-read-numeric"],
+ "write_throughput" : values["data-written-numeric"],
}
if item != "SUMMARY":
@@ -233,6 +244,3 @@ check_info['hp_msa_volume.io'] = {
'group' : 'diskstat',
'includes' : [ "hp_msa.include",
"diskstat.include" ],
}
-
-#.
-