Module: check_mk
Branch: master
Commit: c22d51accac4891ef597bee981f0616da1f363dd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c22d51accac489…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri Oct 16 09:32:20 2015 +0200
#2695 hp_msa_disk, hp_msa_volume: these checks now report more information about disks and
volumes of a HP MSA 2040 Storage System
---
.werks/2695 | 9 +++++++++
ChangeLog | 1 +
checks/hp_msa.include | 49 ++++++++++++++++++++++++++++---------------------
checks/hp_msa_system | 2 +-
checks/hp_msa_volume | 2 +-
5 files changed, 40 insertions(+), 23 deletions(-)
diff --git a/.werks/2695 b/.werks/2695
new file mode 100644
index 0000000..057236a
--- /dev/null
+++ b/.werks/2695
@@ -0,0 +1,9 @@
+Title: hp_msa_disk, hp_msa_volume: these checks now report more information about disks
and volumes of a HP MSA 2040 Storage System
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1444980637
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index e52b453..76db21a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -104,6 +104,7 @@
* 2621 check_http: Can now be configured to check via IPv6
* 2694 cmctc_lcp: this check monitors now the device levels
* 2659 Added IPv6 support to the windows agent...
+ * 2695 hp_msa_disk, hp_msa_volume: these checks now report more information about
disks and volumes of a HP MSA 2040 Storage System
* 2315 FIX: windows agent: BOM replacement, fixed incorrect byte offset...
* 2316 FIX: windows agent: fix garbled output of cached agent plugins...
* 2358 FIX: check_mk_agent.solaris: more correct computation of zfs used space...
diff --git a/checks/hp_msa.include b/checks/hp_msa.include
index 99c777c..9c2bb59 100644
--- a/checks/hp_msa.include
+++ b/checks/hp_msa.include
@@ -41,15 +41,7 @@ def parse_hp_msa(info):
for line in info:
if line[2] == "durable-id":
item_id = " ".join(line[3:])
- if line[0] == "drives":
- item_type = "Disk"
- elif line[0] == "fan":
- item_type = "Fan"
- elif line[0] == "power-supplies":
- item_type = "PSU"
- else:
- item_type = ""
- info_enrolment.setdefault(item_id, {"item_type" : item_type})
+ info_enrolment.setdefault(item_id, {"item_type" : line[0]})
else:
info_enrolment[item_id][line[2]] = " ".join(line[3:])
@@ -68,18 +60,33 @@ def inventory_hp_msa_health(parsed):
def check_hp_msa_health(item, _no_params, parsed):
if item in parsed:
- infotext = "Status: %s" % parsed[item]["health"]
- health_state = hp_msa_state_map[parsed[item]["health"]]
- health_reason = parsed[item].get("health-reason", "")
-
- extra_info = ""
- if health_reason:
- extra_info = " (%s)" % health_reason
-
- if health_state > 0:
- infotext += extra_info
-
- return health_state, infotext
+ infotexts = []
+ health_state = hp_msa_state_map[parsed[item]["health"]]
+ health_info = "Status: %s" % parsed[item]["health"]
+ if health_state and parsed[item].get("health-reason", ""):
+ health_info += " (%s)" % parsed[item]["health-reason"]
+
+ infotexts.append(health_info)
+
+ # extra info of volumes
+ if parsed[item]["item_type"] == "volumes":
+ volume_info = parsed[item].get("container-name", "")
+ if volume_info:
+ if parsed[item].get("raidtype", ""):
+ volume_info += " (%s)" %
parsed[item]["raidtype"]
+ infotexts.append("container name: %s" % volume_info)
+
+ # extra info of disks
+ elif parsed[item]["item_type"] == "drives":
+ for disk_info in ["serial-number", "vendor",
"model", "description", "size"]:
+ if parsed[item].get(disk_info, ""):
+ infotexts.append("%s: %s" % \
+ (disk_info.replace("-", " "),
parsed[item][disk_info].replace("GB", " GB") ))
+
+ if parsed[item].get("rpm", ""):
+ infotexts.append("speed: %s RPM" %
(parsed[item]["rpm"]))
+
+ return health_state, ", ".join(infotexts)
def inventory_hp_msa_io(parsed):
diff --git a/checks/hp_msa_system b/checks/hp_msa_system
index 16b18e9..fa8987e 100644
--- a/checks/hp_msa_system
+++ b/checks/hp_msa_system
@@ -69,7 +69,7 @@ def parse_hp_msa_system(info):
for line in info:
if line[2] == "system-name":
system_name = " ".join(line[3:])
- parsed[system_name] = {}
+ parsed[system_name] = {"item_type" : line[0]}
elif line[2] == "health":
parsed[system_name]["health"] = " ".join(line[3:])
elif line[2] == "health-reason":
diff --git a/checks/hp_msa_volume b/checks/hp_msa_volume
index 1a91af8..893ce8a 100644
--- a/checks/hp_msa_volume
+++ b/checks/hp_msa_volume
@@ -140,7 +140,7 @@ def parse_hp_msa_volume(info):
if line[0] == "volumes":
if line[2] == "durable-id":
volume_id = " ".join(line[3:])
- parsed[volume_id] = {"item_type" : "Volume"}
+ parsed[volume_id] = {"item_type" : line[0]}
else:
parsed[volume_id][line[2]] = " ".join(line[3:])
else: