Module: check_mk
Branch: master
Commit: 1e5e7f8d3d679115e0edf5a97b9552401c4806db
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1e5e7f8d3d6791…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Oct 15 14:09:45 2013 +0200
qnap_disks: New check for Hardisks in Qnap devices
---
ChangeLog | 1 +
checkman/qnap_disks | 18 +++++++++++++++++
checks/qnap_disks | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 74 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 7fd8a10..cae8fd0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,6 +30,7 @@
* FIX: esx_vsphere_hostsystem: fixed bug in handling of params
* steelhead_perrs: New check for Rivergate Gateways
* alcatel_power: Check for power supplies on Alcatel switches
+ * qnap_disks: New check for Hardisks in Qnap devices
WATO:
* You can now have site-specific global settings when using
diff --git a/checkman/qnap_disks b/checkman/qnap_disks
new file mode 100644
index 0000000..97d6e19
--- /dev/null
+++ b/checkman/qnap_disks
@@ -0,0 +1,18 @@
+title: Qnap Harddisk Status
+agents: snmp
+catalog: hw/storagehw/qnap
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the health and current Status of
+ Hardisks attached to a qnap NAS device.
+ The check returns an {CRIT} in case of an error state reported
+ by the device. The check also reports the model number, size and the
+ temperature for each disk.
+
+item:
+ The name of the disk like reported in the MIB
+
+inventory:
+ One check is created for each Disk
+
diff --git a/checks/qnap_disks b/checks/qnap_disks
new file mode 100644
index 0000000..74a0c45
--- /dev/null
+++ b/checks/qnap_disks
@@ -0,0 +1,55 @@
+#!/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.
+
+def inventory_qnap_disks(info):
+ return [ (x[0], None) for x in info ]
+
+def check_qnap_disks(item, _no_params, info):
+ for desc, temp, status, model, size, cond in info:
+ if desc == item:
+ msg = "Model: %s, Temperatur: %s, Size: %s" % \
+ ( model, temp, size )
+ if int(status) != 0:
+ return 2, "Status: %s (Code: %s) %s" % ( cond, status, msg)
+ return 0, msg
+ return 3, "Disk not longer found in output"
+
+check_info["qnap_disks"] = {
+ "check_function" : check_qnap_disks,
+ "inventory_function" : inventory_qnap_disks,
+ "service_description" : "Disk %s",
+ "has_perfdata" : False,
+ "snmp_info" : (".1.3.6.1.4.1.24681.1.2.11.1",[
+ 2, # Description
+ 3, # Temperature
+ 4, # Disk Status (-5 = missing)
+ 5, # Disk Model
+ 6, # Disk Size
+ 7, # Status Text
+ ] ),
+ "snmp_scan_function" : lambda oid:
oid('.1.3.6.1.2.1.1.1.0').startswith('Linux TS-')
+}
+