Module: check_mk
Branch: master
Commit: 381025139e9f50061e70a33e393240b2450f1cae
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=381025139e9f50…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Mon Sep 7 11:29:48 2015 +0200
#2572 omreport_vdisk: New check for virtual disks on Dell OpenManage supported devices
---
.werks/2572 | 9 ++++++
ChangeLog | 1 +
agents/plugins/mk_omreport | 30 ++++++++++++++++++
checkman/omreport_vdisk | 20 ++++++++++++
checks/omreport.include | 60 ++++++++++++++++++++++++++++++++++++
checks/omreport_vdisk | 73 ++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 193 insertions(+)
diff --git a/.werks/2572 b/.werks/2572
new file mode 100644
index 0000000..d2b9f5a
--- /dev/null
+++ b/.werks/2572
@@ -0,0 +1,9 @@
+Title: omreport_vdisk: New check for virtual disks on Dell OpenManage supported devices
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1441618103
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 9b03f53..f0da4e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -72,6 +72,7 @@
* 2563 ipr400_temp, ipr400_in_voltage: New checks for the Omnitronics IPR400
* 2583 new check datapower_tcp: monitors the number of TCP connections in the various
possible states
* 2565 dell_om_disks now warns if SMART predicts disk failure
+ * 2572 omreport_vdisk: New check for virtual disks on Dell OpenManage supported
devices
* 2315 FIX: windows agent: BOM replacement, fixed incorrect byte offset...
* 2316 FIX: windows agent: fix garbled output of cached agent plugins...
* 2358 FIX: check_mk_agent.solaris: more correct computation of zfs used space...
diff --git a/agents/plugins/mk_omreport b/agents/plugins/mk_omreport
new file mode 100755
index 0000000..fb84fc5
--- /dev/null
+++ b/agents/plugins/mk_omreport
@@ -0,0 +1,30 @@
+#!/bin/bash
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | 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.
+
+if which omreport >/dev/null
+then
+ echo "<<<omreport_vdisk>>>"
+ omreport storage vdisk
+fi
diff --git a/checkman/omreport_vdisk b/checkman/omreport_vdisk
new file mode 100644
index 0000000..5c34428
--- /dev/null
+++ b/checkman/omreport_vdisk
@@ -0,0 +1,20 @@
+title: Dell OpenManage: Virtual Disks
+agents: linux
+catalog: hw/server/dell
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the current status of Virtual Disks (i.e. raid) on
+ a Dell server.
+ The check returns error states based on what the device reports itself.
+ It also returns a {CRIT} if the "state" of the device isn't reported as
"ready".
+
+ This check requires the omreport tool to be installed and the mk_omreport plugin
+ to be installed.
+
+item:
+ Vogical disk number as reported by omreport
+
+inventory:
+ One check is created for each virtual disk
+
diff --git a/checks/omreport.include b/checks/omreport.include
new file mode 100644
index 0000000..8d8ea5a
--- /dev/null
+++ b/checks/omreport.include
@@ -0,0 +1,60 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2015 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 parse_omreport(info):
+ result = {}
+ current_obj = {}
+
+ def insert(obj):
+ result[obj["ID"]] = obj.copy()
+ obj.clear()
+
+ for line in info:
+ try:
+ idx = line.index(":")
+ except ValueError:
+ # no colon in the line
+ continue
+ key = " ".join(line[:idx])
+ value = " ".join(line[idx + 1:])
+ if key == "ID" and current_obj:
+ insert(current_obj)
+
+ current_obj[key] = value
+
+ insert(current_obj)
+ return result
+
+
+def status_translate_omreport(code):
+ return {
+ "ok" : 0,
+ "non-critical" : 1,
+ "critical" : 2,
+ "not found" : 3
+ }.get(code.lower(), 2)
+
diff --git a/checks/omreport_vdisk b/checks/omreport_vdisk
new file mode 100644
index 0000000..9b608ac
--- /dev/null
+++ b/checks/omreport_vdisk
@@ -0,0 +1,73 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2015 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.
+
+
+# sample agent output:
+#
+# <<<omreport_vdisk>>>
+# ID : 0
+# Status : Ok
+# Name : Virtual Disk 0
+# State : Ready
+# Hot Spare Policy violated : Not Assigned
+# Encrypted : Not Applicable
+# Layout : RAID-1
+# Size : 278.88 GB (299439751168 bytes)
+# T10 Protection Information Status : No
+# Associated Fluid Cache State : Not Applicable
+# Device Name : /dev/sda
+# Bus Protocol : SAS
+# Media : HDD
+# Read Policy : Read Ahead
+# Write Policy : Write Back
+# Cache Policy : Not Applicable
+# Stripe Element Size : 64 KB
+# Disk Cache Policy : Unchanged
+
+
+def inventory_omreport_vdisk(parsed):
+ return [(key, None) for key in parsed.keys()]
+
+
+def check_omreport_vdisk(item, params, parsed):
+ if item in parsed:
+ status = status_translate_omreport(parsed[item]["Status"])
+ if parsed[item]["State"] != "Ready":
+ status = 2
+
+ return status, "Device: %s, Status: %s, State: %s, Layout: %s" %\
+ (parsed[item]["Device Name"], parsed[item]["Status"],
+ parsed[item]["State"], parsed[item]["Layout"])
+
+
+check_info["omreport_vdisk"] = {
+ "check_function" : check_omreport_vdisk,
+ "inventory_function" : inventory_omreport_vdisk,
+ "parse_function" : parse_omreport,
+ "service_description" : "Virtual Disk %s",
+ "includes" : ["omreport.include"]
+}
+