Module: check_mk
Branch: master
Commit: 9bfd85a2a8838b72db6e0527f08db7f31b2a2f20
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9bfd85a2a8838b…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Mon Mar 7 17:14:39 2016 +0100
3088 rstcli, rstcli.pdisks: new checks to monitor Intel RST raids
---
.werks/3088 | 9 ++
ChangeLog | 1 +
agents/windows/plugins/rstcli.bat | 15 ++++
checkman/rstcli | 24 +++++
checkman/rstcli.pdisks | 24 +++++
checks/rstcli | 177 +++++++++++++++++++++++++++++++++++++
6 files changed, 250 insertions(+)
diff --git a/.werks/3088 b/.werks/3088
new file mode 100644
index 0000000..adc41c1
--- /dev/null
+++ b/.werks/3088
@@ -0,0 +1,9 @@
+Title: rstcli, rstcli.pdisks: new checks to monitor Intel RST raids
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.9i1
+Date: 1457367232
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 7bfb212..68956b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,7 @@
* 3085 fortigate_signatures: new check to monitor av and ips signatures on fortigate
firewalls...
* 3257 dell_idrac_virtdisks: new check which monitors the virtual disks of a Dell
IDrac Device
* 3001 fileinfo: now able to configure the checks status if the file is missing
+ * 3088 rstcli, rstcli.pdisks: new checks to monitor Intel RST raids
* 3073 FIX: windows agent: relative paths to mrpe scripts are now treated as relative
to the agent installation directory...
* 3061 FIX: mk_jolokia: Fixed debugging of the agent plugin
* 3074 FIX: windows agent: fixed incorrect values for 32-bit performance counters
diff --git a/agents/windows/plugins/rstcli.bat b/agents/windows/plugins/rstcli.bat
new file mode 100644
index 0000000..a2c041f
--- /dev/null
+++ b/agents/windows/plugins/rstcli.bat
@@ -0,0 +1,15 @@
+@ECHO off & setlocal EnableDelayedExpansion
+
+REM customize rstcli to your needs
+SET "rstcli=!ProgramFiles!\rstcli\rstcli64.exe"
+SET "rstcli_x86=!ProgramFiles!\rstcli\rstcli.exe"
+
+ECHO ^<^<^<rstcli:sep(58)^>^>^>
+IF EXIST !rstcli! (
+ !rstcli! --information --volume
+) ELSE IF EXIST !rstcli_x86! (
+ !rstcli_x86! --information --volume
+) ELSE (
+ ECHO rstcli not found
+)
+
diff --git a/checkman/rstcli b/checkman/rstcli
new file mode 100644
index 0000000..d91faaa
--- /dev/null
+++ b/checkman/rstcli
@@ -0,0 +1,24 @@
+title: Intel Rapid Storage Technologie: State of raid volumes
+agents: windows
+catalog: os/storage
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the overall state of raid volumes set up
+ through Intel Rapid Storage Technologie.
+
+ Due to lack of documentation, this tool will only accept "Normal" as a
healthy
+ state, all others are treated as critical. Please let us know about other states
+ you encounter.
+
+ For this check to work, the rstcli tool and the matching agent plugin have to
+ be installed.
+
+ The utility {rstcli} can be downloaded from
+
{https://downloadcenter.intel.com/download/24310/Intel-Rapid-Storage-Technology-Command-Line-Interface-RST-CLI}
+
+item:
+ The name of the raid volume.
+
+inventory:
+ One service is created for each volume.
diff --git a/checkman/rstcli.pdisks b/checkman/rstcli.pdisks
new file mode 100644
index 0000000..1961edc
--- /dev/null
+++ b/checkman/rstcli.pdisks
@@ -0,0 +1,24 @@
+title: Intel Rapid Storage Technologie: State of physical disks in raids
+agents: windows
+catalog: os/storage
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the state of the physical disks of a raid set up
+ through Intel Rapid Storage Technologie.
+
+ Due to lack of documentation, this tool will only accept "Normal" as a
healthy
+ state, all others are treated as critical. Please let us know about other states
+ you encounter.
+
+ For this check to work, the rstcli tool and the matching agent plugin have to
+ be installed.
+
+ The utility {rstcli} can be downloaded from
+
{https://downloadcenter.intel.com/download/24310/Intel-Rapid-Storage-Technology-Command-Line-Interface-RST-CLI}
+
+item:
+ A combination of the raid volume and the drive ID within that volume.
+
+inventory:
+ One service is created for each disk.
diff --git a/checks/rstcli b/checks/rstcli
new file mode 100644
index 0000000..4ea3736
--- /dev/null
+++ b/checks/rstcli
@@ -0,0 +1,177 @@
+#!/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-
+# tails. 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.
+
+
+# --VOLUME INFORMATION--
+#
+# Name: Vol1
+# Raid Level: 1
+# Size: 932 GB
+# StripeSize: 64 KB
+# Num Disks: 2
+# State: Normal
+# System: True
+# Initialized: True
+# Cache Policy: Off
+#
+#
+# --DISKS IN VOLUME: Vol1 --
+#
+# ID: 0-0-0-0
+# Type: Disk
+# Disk Type: SATA Disk
+# State: Normal
+# Size: 932 GB
+# Free Size: 0 GB
+# System Disk: False
+# Usage: Array member
+# Serial Number: AB-CDEF123456
+# Model: AB CD EF
+#
+# ID: 0-1-0-0
+# Type: Disk
+# Disk Type: SATA Disk
+# State: Normal
+# Size: 932 GB
+# Free Size: 0 GB
+# System Disk: False
+# Usage: Array member
+# Serial Number: AB-CDEF123457
+# Model: AB CD EF
+
+
+# split output into the --xxx-- sections
+def parse_rstcli_sections(info):
+ current_section = None
+ for line in info:
+ if line[0].startswith("--"):
+ if current_section is not None:
+ yield current_section
+ current_section = (":".join(line).strip("-").strip(),
[])
+ else:
+ if current_section is None:
+ raise MKGeneralException("error: %s" % "
".join(line))
+ current_section[1].append(line)
+
+ yield current_section
+
+
+# interpret the volumes section
+def parse_rstcli_volumes(rows):
+ volumes = {}
+ current_volume = None
+
+ for row in rows:
+ if row[0] == "Name":
+ volumes[row[1].strip()] = current_volume = {}
+ else:
+ current_volume[row[0]] = row[1].strip()
+
+ return volumes
+
+
+# interpret the disks section
+def parse_rstcli_disks(rows):
+ disks = []
+ current_disk = None
+
+ for row in rows:
+ if row[0] == "ID":
+ current_disk = {}
+ disks.append(current_disk)
+
+ current_disk[row[0]] = row[1].strip()
+
+ return disks
+
+def parse_rstcli(info):
+ volumes = {}
+
+ for section in parse_rstcli_sections(info):
+ if section[0] == "VOLUME INFORMATION":
+ volumes = parse_rstcli_volumes(section[1])
+ elif section[0].startswith("DISKS IN VOLUME"):
+ volume = section[0].split(":")[1].strip()
+ volumes[volume]['Disks'] = parse_rstcli_disks(section[1])
+ else:
+ raise MKGeneralException("invalid section in rstcli output: %s" %
section[0])
+
+ return volumes
+
+
+def inventory_rstcli(parsed):
+ return [(name, None) for name in parsed.keys()]
+
+
+# Help! There is no documentation, what are the possible values?
+rstcli_states = {
+ 'Normal': 0,
+}
+
+
+def check_rstcli(item, params, parsed):
+ if item in parsed:
+ volume = parsed[item]
+ return rstcli_states.get(volume['State']), "RAID %s, %d disks (%s),
state %s" % \
+ (volume['Raid Level'], int(volume['Num Disks']),
+ volume['Size'], volume['State'])
+
+
+check_info["rstcli"] = {
+ 'check_function': check_rstcli,
+ 'inventory_function': inventory_rstcli,
+ 'parse_function': parse_rstcli,
+ 'service_description': 'RAID Volume %s',
+}
+
+
+def inventory_rstcli_pdisks(parsed):
+ for key, volume in parsed.iteritems():
+ for disk in volume['Disks']:
+ yield "%s/%s" % (key, disk['ID']), None
+
+
+def check_rstcli_pdisks(item, params, parsed):
+ reg = regex("(.*)/([0-9\-]*)")
+ match = reg.match(item)
+ if match:
+ return 3, "unsupported item name"
+
+ volume, disk_id = match.group(1), match.group(2)
+
+ disks = parsed.get(volume, {}).get('Disks', [])
+ for disk in disks:
+ if disk['ID'] == disk_id:
+ return rstcli_states.get(disk['State'], 2), \
+ "[%s] state %s" % (disk['Serial Number'],
disk['State'])
+
+
+check_info["rstcli.pdisks"] = {
+ 'check_function': check_rstcli_pdisks,
+ 'inventory_function': inventory_rstcli_pdisks,
+ 'service_description': 'RAID Disk %s',
+}
+