Module: check_mk
Branch: master
Commit: 93f175998fbd3600d3621b707dfd81afa6807804
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=93f175998fbd36…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Mon Apr 13 14:09:43 2015 +0200
#2113 hitachi_hnas_drives: new check to determine the overall status of all system drives
of Hitachi NAS devices
---
.werks/2113 | 9 ++++++
ChangeLog | 1 +
checkman/hitachi_hnas_drives | 22 ++++++++++++++
checks/hitachi_hnas_drives | 67 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 99 insertions(+)
diff --git a/.werks/2113 b/.werks/2113
new file mode 100644
index 0000000..cfb46b4
--- /dev/null
+++ b/.werks/2113
@@ -0,0 +1,9 @@
+Title: hitachi_hnas_drives: new check to determine the overall status of all system
drives of Hitachi NAS devices
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1428926934
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index d3ad27e..ae36f92 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -159,6 +159,7 @@
* 2112 hitachi_hnas_bossock: new check to monitor number of running Bossock Fibers
* 2196 winperf_if: for Windows interfaces show original Windows state names
* 2199 livestatus_status: now in addition check master settings of monitoring
core...
+ * 2113 hitachi_hnas_drives: new check to determine the overall status of all system
drives of Hitachi NAS devices
* 1457 FIX: logins: new check renamed from "users" check...
NOTE: Please refer to the migration notes!
* 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
diff --git a/checkman/hitachi_hnas_drives b/checkman/hitachi_hnas_drives
new file mode 100644
index 0000000..a279b05
--- /dev/null
+++ b/checkman/hitachi_hnas_drives
@@ -0,0 +1,22 @@
+title: Hitachi HNAS: Status of System Drives
+agents: snmp
+catalog: hw/storagehw/hitachi
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the status of system drives of Hitachi NAS-Devices.
+ It was tested against Hitachi HNAS Modell 3090 but probably will work
+ for other HNAS devices using the BlueArc MIB.
+
+ The check works by scanning the SNMP status information of all system drives
+ as given by the device. It displays the number of drives found in each of the
+ known states - if it is non-zero. Known states are: "Online", "MBR
corrupt",
+ "Failed and unaccessible", "Not present", "Not accessible by
controller",
+ "Offline", "Initializing", "Formatting",
"Unknown",
+
+ All stati except "Online" and "Unknown" trigger a {CRIT} state of
+ the service. "Online" triggers {OK} and "Unknown" triggers
{UNKNOWN}
+
+inventory:
+ One check for each device is created.
+
diff --git a/checks/hitachi_hnas_drives b/checks/hitachi_hnas_drives
new file mode 100644
index 0000000..2ca901f
--- /dev/null
+++ b/checks/hitachi_hnas_drives
@@ -0,0 +1,67 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 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.
+
+
+
+def inventory_hitachi_hnas_drives(info):
+ if info:
+ return [(None, None)]
+
+def parse_hitachi_hnas_drives(info):
+ parsed = {}
+ for index, status in info:
+ parsed.setdefault(status, 0)
+ parsed[status] += 1
+ return parsed
+
+def check_hitachi_hnas_drives(_no_item, params, info):
+ status_map = (
+ ("Online", 0),
+ ("MBR corrupt", 2),
+ ("Failed and unaccessible", 2),
+ ("Not present", 2),
+ ("Not accessible by controller", 2),
+ ("Offline", 2),
+ ("Initializing", 2),
+ ("Formatting", 2),
+ ("Unknown", 3),
+ )
+ for status, count in info.iteritems():
+ infotext = "%s: %d" % (status_map[int(status)-1][0], count)
+ yield status_map[int(status)-1][1], infotext
+
+
+check_info["hitachi_hnas_drives"] = {
+ "check_function" : check_hitachi_hnas_drives,
+ "inventory_function" : inventory_hitachi_hnas_drives,
+ "parse_function" : parse_hitachi_hnas_drives,
+ "service_description" : "System Drives",
+ "snmp_info" : (".1.3.6.1.4.1.11096.6.1.1.1.3.4.2.1",
[
+ 1, # sysDriveIndex
+ 4, # sysDriveStatus
+ ]),
+ "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.11096.6"),
+}