Module: check_mk
Branch: master
Commit: f32521940c3dd05cb646e9bfb2c6b3609ae76892
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f32521940c3dd0…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Mon Jan 20 12:29:15 2014 +0100
emcvnx_raidgroups.list_luns: New check for EMC VNX storage system
reporting the List of LUNs used in a RAID Group
---
.werks/461 | 8 +++
ChangeLog | 1 +
agents/special/agent_emcvnx | 11 ++--
checkman/emcvnx_raidgroups.list_luns | 18 ++++++
checks/emcvnx_raidgroups | 105 +++++++++++++++++++++++++++++++
web/plugins/wato/datasource_programs.py | 1 +
6 files changed, 139 insertions(+), 5 deletions(-)
diff --git a/.werks/461 b/.werks/461
new file mode 100644
index 0000000..ee4d2af
--- /dev/null
+++ b/.werks/461
@@ -0,0 +1,8 @@
+Title: emcvnx_raidgroups.list_luns: New check for EMC VNX storage system
+Level: 2
+Component: checks
+Version: 1.2.5i1
+Date: 1390217290
+Class: feature
+
+reporting the List of LUNs used in a RAID Group
diff --git a/ChangeLog b/ChangeLog
index 1a7638a..26eb5e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -52,6 +52,7 @@
* 0450 mem.used: Add information about shared memory (on Linux hosts)
* 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...
* 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/agents/special/agent_emcvnx b/agents/special/agent_emcvnx
index 2d5b76f..887ba29 100755
--- a/agents/special/agent_emcvnx
+++ b/agents/special/agent_emcvnx
@@ -64,10 +64,10 @@ OPTIONS:
--profile Enable performance profiling in Python source code
-i MODULES, --modules MODULES Modules to query. This is a comma separated list of
- which may contain the keywords "disks",
"hba", "hwstatus"
- or "all" to define which information should be
queried
- from the SP. You can define to use only view of them
- to optimize performance. The default is "all".
+ which may contain the keywords "disks",
"hba", "hwstatus",
+ "raidgroups" or "all" to define which
information should
+ be queried from the SP. You can define to use only view
of
+ them to optimize performance. The default is
"all".
""")
@@ -98,6 +98,7 @@ naviseccli_options = {
"disks" : {"cmd_option" : "-disk",
"active" : False},
"hba" : {"cmd_option" : "-hba",
"active" : False},
"hwstatus" : {"cmd_option" : "-array",
"active" : False},
+ "raidgroups" : {"cmd_option" : "-rg",
"active" : False},
# "agent-info" : {"cmd_option" : "-sp",
"active" : False},
}
@@ -148,7 +149,7 @@ for module in naviseccli_options.keys():
# fetch information by calling naviseccli
#############################################################################
-basecmd="naviseccli -h %s -User %s -Password %s -Scope 0 getall " %
(host_address, user, password)
+basecmd="naviseccli -h %s -User %s -Password '%s' -Scope 0 getall " %
(host_address, user, password)
#
# check_mk section of agent output
diff --git a/checkman/emcvnx_raidgroups.list_luns b/checkman/emcvnx_raidgroups.list_luns
new file mode 100644
index 0000000..831e8e7
--- /dev/null
+++ b/checkman/emcvnx_raidgroups.list_luns
@@ -0,0 +1,18 @@
+title: EMC VNX Storage: RAID Group: List of LUNs
+agents: emc
+catalog: hw/storagehw/emc
+license: GPL
+distribution: check_mk
+description:
+ Reports the List of LUNs 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
new file mode 100644
index 0000000..ded40c5
--- /dev/null
+++ b/checks/emcvnx_raidgroups
@@ -0,0 +1,105 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+# Example output from agent:
+# <<<emcvnx_raidgroups>>>
+#
+#
+# Server IP Address: 172.16.8.82
+# Agent Rev: 7.32.27 (0.14)
+#
+#
+# All RAID Groups Information
+# ----------------------------
+#
+#
+# RaidGroup ID: 0
+# RaidGroup Type: r5
+# RaidGroup State: Explicit_Remove
+# Valid_luns
+# List of disks: Bus 0 Enclosure 0 Disk 0
+# Bus 0 Enclosure 0 Disk 1
+# Bus 0 Enclosure 0 Disk 2
+# Bus 0 Enclosure 0 Disk 3
+# List of luns: 4
+# Max Number of disks: 16
+# Max Number of luns: 256
+# Raw Capacity (Blocks): 702504960
+# Logical Capacity (Blocks): 526878720
+# Free Capacity (Blocks,non-contiguous): 0
+# Free contiguous group of unbound segments: 0
+# Defrag/Expand priority: Medium
+# Percent defragmented: 100
+# Percent expanded: N/A
+# Disk expanding onto: N/A
+# Lun Expansion enabled: NO
+# Legal RAID types: r5
+#
+# RaidGroup ID: 124
+# RaidGroup Type: hot_spare
+# [...]
+
+# Parse agent output into a dict of the form:
+# (where the RAID Group ID is used as key)
+# parsed = {'0': {'luns': '4'},
+# '1': {'luns': '0,1'},
+# '124': {'luns': '4089'},
+# '2': {'luns': '2,3'}}
+
+
+def parse_emcvnx_raidgroups(info):
+ parsed = {}
+ for line in info:
+ if len(line) > 2 and line[0] == "RaidGroup" and line[1] ==
"ID:":
+ rg = {}
+ parsed[line[2]] = rg
+ elif len(line) > 3 and line[0] == "List" and line[1] ==
"of" and line[2] == "luns:":
+ luns = ",".join(line[3:])
+ rg["luns"] = luns
+ return parsed
+
+
+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))
+ return inventory
+
+
+def check_emcvnx_raidgroups_list_luns(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
+ return 0, "List of LUNs: " + parsed[item]["luns"]
+
+
+check_info['emcvnx_raidgroups.list_luns'] = {
+ "inventory_function" : inventory_emcvnx_raidgroups_list_luns,
+ "check_function" : check_emcvnx_raidgroups_list_luns,
+ "service_description" : "RAID Group %s LUNs"
+}
diff --git a/web/plugins/wato/datasource_programs.py
b/web/plugins/wato/datasource_programs.py
index 71660d8..50c4fe3 100644
--- a/web/plugins/wato/datasource_programs.py
+++ b/web/plugins/wato/datasource_programs.py
@@ -189,6 +189,7 @@ register_rule(group,
( "disks", _("Disks") ),
( "hba", _("iSCSI HBAs") ),
( "hwstatus", _("Hardware Status") ),
+ ( "raidgroups", _("RAID Groups") ),
],
default_value = [ "disks", "hba",
"hwstatus", ],
allow_empty = False,