Module: check_mk
Branch: master
Commit: 9a315c357b7d377e4691fd812a1e53fc6e58f5c0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9a315c357b7d37…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Tue Jun 5 14:01:45 2018 +0200
6200 Status of Quantum Storage Devices
quantum_storage_status: Create a service to monitor the operating state of
a Quantum Storage Device.
The states can be mapped to the desired monitoring status via the rule
"Quantum Storage Status".
snmp_quantum_storage_info: Add manufacturer, model and serial number to
HW/SW inventory.
Change-Id: I74b18888b10c3b22b9ad176a550883b7393345f0
---
.werks/6200 | 16 +++++++++
checkman/quantum_storage_status | 12 +++++++
checks/quantum_storage_status | 69 ++++++++++++++++++++++++++++++++++++
inventory/snmp_quantum_storage_info | 48 +++++++++++++++++++++++++
web/plugins/wato/check_parameters.py | 32 +++++++++++++++++
5 files changed, 177 insertions(+)
diff --git a/.werks/6200 b/.werks/6200
new file mode 100644
index 0000000..d09e69b
--- /dev/null
+++ b/.werks/6200
@@ -0,0 +1,16 @@
+Title: Status of Quantum Storage Devices
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1528199794
+Class: feature
+
+quantum_storage_status: Create a service to monitor the operating state of
+a Quantum Storage Device.
+The states can be mapped to the desired monitoring status via the rule
+"Quantum Storage Status".
+snmp_quantum_storage_info: Add manufacturer, model and serial number to
+HW/SW inventory.
+
diff --git a/checkman/quantum_storage_status b/checkman/quantum_storage_status
new file mode 100644
index 0000000..bccb275
--- /dev/null
+++ b/checkman/quantum_storage_status
@@ -0,0 +1,12 @@
+title: Status of Quantum Storage Devices
+agents: snmp
+catalog: hw/storagehw/quantum
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the state variables of Quantum Storage Devices.
+ The states can be mapped to the desired monitoring status via the
+ rule "Quantum Storage Status".
+
+inventory:
+ One service is created.
diff --git a/checks/quantum_storage_status b/checks/quantum_storage_status
new file mode 100644
index 0000000..7aa81bd
--- /dev/null
+++ b/checks/quantum_storage_status
@@ -0,0 +1,69 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2018 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.
+
+
+factory_settings["quantum_storage_status"] = {
+ 'map_states': {'unavailable': 2,
+ 'available': 0,
+ 'online': 0,
+ 'offline': 2,
+ 'going online': 1,
+ 'state not available': 3,
+ },
+}
+
+
+quantum_device_state = {'1': 'unavailable',
+ '2': 'available',
+ '3': 'online',
+ '4': 'offline',
+ '5': 'going online',
+ '6': 'state not available',
+ }
+
+
+def inventory_quantum_storage_status(info):
+ return [ (None, None) ]
+
+
+def check_quantum_storage_status(_no_item, params, info):
+ state_txt = quantum_device_state.get(info[0][0])
+ status = params['map_states'].get(state_txt, 3)
+ return status, "Device state: %s" % state_txt
+
+
+check_info['quantum_storage_status'] = {
+ "check_function" : check_quantum_storage_status,
+ "inventory_function" : inventory_quantum_storage_status,
+ "service_description" : "Device status",
+ "group" : "quantum_storage_status",
+ "default_levels_variable" : "quantum_storage_status",
+ "snmp_info" : (".1.3.6.1.4.1.2036.2.1.1", [ #
qSystemInfo
+ "7", # qState
+ ]),
+ "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.4.1.2036.2.1.1.7.0"),
+}
+
diff --git a/inventory/snmp_quantum_storage_info b/inventory/snmp_quantum_storage_info
new file mode 100644
index 0000000..788b1eb
--- /dev/null
+++ b/inventory/snmp_quantum_storage_info
@@ -0,0 +1,48 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2018 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.
+
+
+def inv_snmp_quantum_storage_info(info, inventory_tree):
+
+ manufacturer, product, revision, serial = info[0]
+
+ node = inventory_tree.get_dict("hardware.system.")
+ node["manufacturer"] = manufacturer
+ node["product"] = product
+ node["revision"] = revision
+ node["serial"] = serial
+
+
+inv_info['snmp_quantum_storage_info'] = {
+ 'inv_function' : inv_snmp_quantum_storage_info,
+ 'snmp_info' : ('.1.3.6.1.4.1.2036.2.1.1', [ # qSystemInfo
+ "4", # 0 1 qVendorID
+ "5", # 0 2 qProdId
+ "6", # 0 3 qProdRev
+ "12", # 0 4 qSerialNumber
+ ]),
+ 'snmp_scan_function' : lambda oid:
oid('.1.3.6.1.4.1.2036.2.1.1.4.0'),
+}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 923e331..581f854 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -5948,6 +5948,38 @@ register_check_parameters(
"dict",
)
+
+register_check_parameters(
+ subgroup_storage,
+ "quantum_storage_status",
+ _("Quantum Storage Status"),
+ Dictionary(
+ elements = [
+ ("map_states", Dictionary(
+ elements = [
+ ("unavailable", MonitoringState(title=_("Device
unavailable"),
+ default_value=2)),
+ ("available", MonitoringState(title=_("Device
available"),
+ default_value=0)),
+ ("online", MonitoringState(title=_("Device
online"),
+ default_value=0)),
+ ("offline", MonitoringState(title=_("Device
offline"),
+ default_value=2)),
+ ("going online", MonitoringState(title=_("Device
going online"),
+ default_value=1)),
+ ("state not available",
MonitoringState(title=_("Device state not available"),
+ default_value=3)),
+ ],
+ title = _('Map Device States'),
+ optional_keys = [],
+ )),
+ ]
+ ),
+ None,
+ "dict",
+)
+
+
register_check_parameters(
subgroup_environment,
"apc_system_events",