Module: check_mk
Branch: master
Commit: 32e2d936aaf0950afb1a1300f4df908612e04a37
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=32e2d936aaf095…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Mon Jan 20 13:46:21 2014 +0100
emcvnx_raidgroups.list_disks: New check for EMC VNX storage system
reporting the List of Disks used in a RAID Group
---
.werks/462 | 8 ++++
ChangeLog | 1 +
checkman/emcvnx_raidgroups.list_disks | 18 +++++++++
checks/emcvnx_raidgroups | 70 ++++++++++++++++++++++++++++++++-
4 files changed, 96 insertions(+), 1 deletion(-)
diff --git a/.werks/462 b/.werks/462
new file mode 100644
index 0000000..3c8b01e
--- /dev/null
+++ b/.werks/462
@@ -0,0 +1,8 @@
+Title: emcvnx_raidgroups.list_disks: New check for EMC VNX storage system
+Level: 2
+Component: checks
+Version: 1.2.5i1
+Date: 1390221906
+Class: feature
+
+reporting the List of Disks used in a RAID Group
diff --git a/ChangeLog b/ChangeLog
index 26eb5e4..d5ac8c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -53,6 +53,7 @@
* 0458 hitachi_hnas_fc_if: New check for FibreChannel Interfaces in Hitachi HNAS
storage systems
* 0459 emcvnx_info: New info check providing Model, Revision and Serial Number of EMC
VNX storage systems
* 0461 emcvnx_raidgroups.list_luns: New check for EMC VNX storage system...
+ * 0462 emcvnx_raidgroups.list_disks: New check for EMC VNX storage system...
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/checkman/emcvnx_raidgroups.list_disks
b/checkman/emcvnx_raidgroups.list_disks
new file mode 100644
index 0000000..e932bb5
--- /dev/null
+++ b/checkman/emcvnx_raidgroups.list_disks
@@ -0,0 +1,18 @@
+title: EMC VNX Storage: RAID Group: List of Disks
+agents: emc
+catalog: hw/storagehw/emc
+license: GPL
+distribution: check_mk
+description:
+ Reports the List of Disks used in a RAID Group in an EMC VNX storage system.
+
+ This Check is just informational and always returns {OK}.
+
+ The information is retriefed by the special agent agent_emcvnx which uses
+ EMC's command line tool naviseccli.
+
+item:
+ The RAID Group ID.
+
+inventory:
+ Automatically configures one check for every RAID Group listed in the agent output.
diff --git a/checks/emcvnx_raidgroups b/checks/emcvnx_raidgroups
index ded40c5..04dc3ab 100644
--- a/checks/emcvnx_raidgroups
+++ b/checks/emcvnx_raidgroups
@@ -72,6 +72,7 @@
def parse_emcvnx_raidgroups(info):
parsed = {}
+ append = False
for line in info:
if len(line) > 2 and line[0] == "RaidGroup" and line[1] ==
"ID:":
rg = {}
@@ -79,12 +80,31 @@ def parse_emcvnx_raidgroups(info):
elif len(line) > 3 and line[0] == "List" and line[1] ==
"of" and line[2] == "luns:":
luns = ",".join(line[3:])
rg["luns"] = luns
+ elif len(line) > 8 and line[0] == "List" and line[1] ==
"of" and line[2] == "disks:":
+ disks = []
+ disk = line[4] + "/" + line[6] + " Disk " + line[8]
+ disks.append(disk)
+ rg["disks"] = disks
+ append = True
+ elif append == True and len(line) > 5 and line[0] == "Bus" and
line[2] == "Enclosure" and line[4] == "Disk":
+ disk = line[1] + "/" + line[3] + " Disk " + line[5]
+ disks.append(disk)
+ elif append == True:
+ append = False
return parsed
+# .--list of LUNs--------------------------------------------------------.
+# | _ _ _ __ _ _ _ _ _ |
+# | | (_)___| |_ ___ / _| | | | | | | \ | |___ |
+# | | | / __| __| / _ \| |_ | | | | | | \| / __| |
+# | | | \__ \ |_ | (_) | _| | |__| |_| | |\ \__ \ |
+# | |_|_|___/\__| \___/|_| |_____\___/|_| \_|___/ |
+# | |
+# '----------------------------------------------------------------------'
+
def inventory_emcvnx_raidgroups_list_luns(info):
parsed = parse_emcvnx_raidgroups(info)
- #import pprint; pprint.pprint(parsed)
inventory = []
for rg in parsed:
inventory.append((rg, None))
@@ -103,3 +123,51 @@ check_info['emcvnx_raidgroups.list_luns'] = {
"check_function" : check_emcvnx_raidgroups_list_luns,
"service_description" : "RAID Group %s LUNs"
}
+
+#.
+# .--list of disks-------------------------------------------------------.
+# | _ _ _ __ _ _ _ |
+# | | (_)___| |_ ___ / _| __| (_)___| | _____ |
+# | | | / __| __| / _ \| |_ / _` | / __| |/ / __| |
+# | | | \__ \ |_ | (_) | _| | (_| | \__ \ <\__ \ |
+# | |_|_|___/\__| \___/|_| \__,_|_|___/_|\_\___/ |
+# | |
+# '----------------------------------------------------------------------'
+
+def inventory_emcvnx_raidgroups_list_disks(info):
+ import pprint; pprint.pprint(info)
+ parsed = parse_emcvnx_raidgroups(info)
+ import pprint; pprint.pprint(parsed)
+ inventory = []
+ for rg in parsed:
+ inventory.append((rg, None))
+ return inventory
+
+
+def check_emcvnx_raidgroups_list_disks(item, _no_params, info):
+ parsed = parse_emcvnx_raidgroups(info)
+ if item not in parsed:
+ return 3, "RAID Group %s not found in agent output" % item
+
+ message = ""
+ enc = ""
+ for disk in sorted(parsed[item]["disks"]):
+ if message != "":
+ message += ", "
+ enc_id, disk_id = disk.split(' ', 1)
+ if enc_id == enc:
+ message += disk_id
+ else:
+ message += "Enclosure " + enc_id + " " + disk_id
+ enc = enc_id
+
+ return 0, "List of Disks: " + message
+
+
+check_info['emcvnx_raidgroups.list_disks'] = {
+ "inventory_function" : inventory_emcvnx_raidgroups_list_disks,
+ "check_function" : check_emcvnx_raidgroups_list_disks,
+ "service_description" : "RAID Group %s Disks"
+}
+
+#.