Module: check_mk
Branch: master
Commit: 8e4a71bbe7cb2e021ad9776c19e4b3de2f54ad20
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8e4a71bbe7cb2e…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Thu Jan 16 16:01:34 2014 +0100
hitachi_hnas_volume: New check for Usage and Status of Volumes in Hitachi HNAS storage
systems
---
.werks/457 | 8 ++++
ChangeLog | 1 +
checkman/hitachi_hnas_volume | 39 +++++++++++++++++
checks/hitachi_hnas_volume | 82 ++++++++++++++++++++++++++++++++++++
web/plugins/perfometer/check_mk.py | 1 +
5 files changed, 131 insertions(+)
diff --git a/.werks/457 b/.werks/457
new file mode 100644
index 0000000..c4a08c4
--- /dev/null
+++ b/.werks/457
@@ -0,0 +1,8 @@
+Title: hitachi_hnas_volume: New check for Usage and Status of Volumes in Hitachi HNAS
storage systems
+Level: 2
+Component: checks
+Version: 1.2.5i1
+Date: 1389884457
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index a1353bd..199368b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -45,6 +45,7 @@
* 0566 services.summary: new check to monitor stopped services of mode autostart in
windows
* 0568 f5_big_ip_conns: check now supports predictive monitoring and both connections
types are merged in one check
* 0257 windows_agent: now reports extended process information (obsoletes psperf.bat
plugin)...
+ * 0457 hitachi_hnas_volume: New check for Usage and Status of Volumes in Hitachi HNAS
storage systems
* 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/hitachi_hnas_volume b/checkman/hitachi_hnas_volume
new file mode 100644
index 0000000..1475129
--- /dev/null
+++ b/checkman/hitachi_hnas_volume
@@ -0,0 +1,39 @@
+title: Hitachi HNAS: Usage and Status of Volumes
+agents: snmp
+catalog: hw/storagehw/hitachi
+license: GPL
+distribution: check_mk
+description:
+ Checks the Usage and Status of Volumes in Hitachi HNAS storage systems.
+
+ For usage it uses the check logic of the {df} check, so for configuration
+ parameters and examples please refer to the man page of {df}.
+
+ If the status of a volume is reported to be "mounted", the check may
+ return {OK}, on status "unformatted" or "formatted", the check
returns
+ at least {WARN}, on "needsChecking" it returns {CRIT} and {UNKN} on
+ every other status.
+
+ The worst status of both (usage levels and status) is returned by the check.
+
+item:
+ The ID of a Volume plus it's label, separated by a space, e. g. 1025 data
+
+perfdata:
+ Three values: The first value is the used space of the volume
+ in MB. Also the minimum (0 MB), maximum (size of the volume) and the
+ warning and critical levels in MB are provided.
+ The second is the change of the usage in MB per range since the last check
+ (e.g. in MB per 24 hours) and the 3rd is the averaged change (so called
+ trend), also in MB per range. Please note, that performance data for
+ trends is enabled per default. You can globally disable that in {main.mk}
+ with {filesystem_default_levels["trend_perfdata"] = False}.
+
+inventory:
+ Finds one item per Volume.
+
+[parameters]
+parameters (dict): See man page of {df}.
+
+[configuration]
+filesystem_default_levels: And other, see man page of {df}.
diff --git a/checks/hitachi_hnas_volume b/checks/hitachi_hnas_volume
new file mode 100644
index 0000000..6eb9b7d
--- /dev/null
+++ b/checks/hitachi_hnas_volume
@@ -0,0 +1,82 @@
+#!/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.
+
+check_includes["hitachi_hnas_volume"] = [ "df.include" ]
+
+def inventory_hitachi_hnas_volume(info):
+ mplist = []
+ for id, label, volume_status, total, free, evs in info:
+ mplist.append(id + " " + label)
+ return df_inventory(mplist)
+
+def check_hitachi_hnas_volume(item, params, info):
+ # use checks from df.include
+ fslist = []
+ for id, label, volume_status, total, free, evs in info:
+ if id + " " + label == item:
+ size_mb = int(total) / 1048576.0
+ avail_mb = int(free) / 1048576.0
+ fslist.append((item, size_mb, avail_mb))
+
+ status, message, perfdata = df_check_filesystem_list(item, params, fslist)
+
+ # evaluate volumeStatus
+ statusmap = (("", 3),
+ ("unformatted", 1),
+ ("mounted", 0),
+ ("formatted", 1),
+ ("needsChecking", 2),
+ )
+
+ error_string = ( "", " (!)", " (!!)",
"" )
+ volume_status=int(volume_status)
+
+ if volume_status == 0 or volume_status >= len(statusmap):
+ message += ", Volume reports unidentified status %s" %
volume_status
+ status = max(status, 3)
+ else:
+ message += ", Status %s%s" % (statusmap[volume_status][0],
error_string[statusmap[volume_status][1]])
+ status = max(status, statusmap[volume_status][1])
+
+ # report evs
+ message += ", assigned to EVS %s" % evs
+ return status, message, perfdata
+
+ return 3, "Volume %s not found" % item
+
+
+check_info["hitachi_hnas_volume"] = {
+ "check_function" : check_hitachi_hnas_volume,
+ "inventory_function" : inventory_hitachi_hnas_volume,
+ "service_description" : "Volume %s",
+ "has_perfdata" : True,
+ "snmp_info" : (".1.3.6.1.4.1.11096.6.1.1.1.3.5.2.1",
[1, 3, 4, 5, 6, 7]),
+ # volumeSysDriveIndex, volumeLabel, volumeStatus,
volumeCapacity,
+ # volumeFreeCapacity, volumeEnterpriseVirtualServer
+ "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.11096.6"),
+ "group" : "filesystem",
+ "default_levels_variable": "filesystem_default_levels",
+}
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index a6bf931..b3a9933 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -72,6 +72,7 @@ perfometers["check_mk-oracle_asm_diskgroup"] =
perfometer_check_mk_df
perfometers["check_mk-mysql_capacity"] = perfometer_check_mk_df
perfometers["check_mk-esx_vsphere_counters.ramdisk"] = perfometer_check_mk_df
perfometers["check_mk-hitachi_hnas_span"] = perfometer_check_mk_df
+perfometers["check_mk-hitachi_hnas_volume"] = perfometer_check_mk_df
def perfometer_esx_vsphere_datastores(row, check_command, perf_data):
used_mb = perf_data[0][1]