allows monitoring of PSU faults
Message-ID: <58b02770.8SOxOWFXdFlRrZwg%ab(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: b72a4ad29967ec39c1fcc155dec6afd3f7c867fd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b72a4ad29967ec…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Feb 24 13:27:45 2017 +0100
4446 new check netapp_api_environment (cluster mode only): allows monitoring of PSU
faults
Change-Id: I485944705b6f1487a8d1a23c1c22e608c1131234
---
.werks/4446 | 10 ++++++++
agents/special/agent_netapp | 8 ++++++
checkman/netapp_api_environment | 13 ++++++++++
checks/netapp_api_environment | 56 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 87 insertions(+)
diff --git a/.werks/4446 b/.werks/4446
new file mode 100644
index 0000000..65c54fc
--- /dev/null
+++ b/.werks/4446
@@ -0,0 +1,10 @@
+Title: new check netapp_api_environment (cluster mode only): allows monitoring of PSU
faults
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1487939170
+Class: feature
+
+
diff --git a/agents/special/agent_netapp b/agents/special/agent_netapp
index 6948d37..2222838 100755
--- a/agents/special/agent_netapp
+++ b/agents/special/agent_netapp
@@ -1133,6 +1133,14 @@ try:
if node in ha_partners:
processed_nodes.append(ha_partners[node])
+
+ # Controller Status
+ enviroment = query("environment-sensors-get-iter")
+ if enviroment:
+ print "<<<netapp_api_enviroment>>>"
+ print format_config(enviroment, "sensor-name",
"sensor-name")
+
+
# Qtree quota usage
quota_info = query("quota-report-iter")
if quota_info:
diff --git a/checkman/netapp_api_environment b/checkman/netapp_api_environment
new file mode 100644
index 0000000..d3ec0bd
--- /dev/null
+++ b/checkman/netapp_api_environment
@@ -0,0 +1,13 @@
+title: NetApp Filer Clustermode: PSU Fault Info
+agents: netapp
+catalog: hw/storagehw/netapp
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the state of the powersupplys sensor states for a NetApp clustermode
filer.
+
+ The checks reports {CRIT} when the discrete-sensor-state differs from {normal}
+
+inventory:
+ One check is created for each PSU found
+
diff --git a/checks/netapp_api_environment b/checks/netapp_api_environment
new file mode 100644
index 0000000..a014ca2
--- /dev/null
+++ b/checks/netapp_api_environment
@@ -0,0 +1,56 @@
+#!/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.
+
+# <<<netapp_api_environment:sep(9)>>>
+# sensor-name PSU1 FAULT sensor-type discrete node-name BIN-CL1-N1
discrete-sensor-value OK discrete-sensor-state normal threshold-sensor-state normal
+
+def inventory_netapp_api_environment(parsed):
+ for key, values in parsed.items():
+ # Let's hope this simple match catches all PSU FAULTs..
+ if "FAULT" in key:
+ item_name = "%s / %s" % (values.get("node-name"),
values.get("sensor-name").replace(" FAULT", ""))
+ yield item_name, None
+
+def check_netapp_api_environment(item, _no_params, parsed):
+ psu = parsed.get("%s.%s" % tuple(item.split(" / ")))
+ if not psu:
+ return
+
+ state = 0
+ if psu.get("discrete-sensor-state") != "normal":
+ state = 2
+
+ yield state, "Sensor state: %s, Sensor value: %s" % \
+ (psu["discrete-sensor-state"],
psu["discrete-sensor-value"])
+
+
+check_info["netapp_api_environment"] = {
+ 'check_function' : check_netapp_api_environment,
+ 'inventory_function' : inventory_netapp_api_environment,
+ 'parse_function' : lambda info: netapp_api_parse_lines(info, custom_keys
= ["node-name", "sensor-name"]),
+ 'service_description' : 'PSU Controller %s',
+ 'includes' : ["netapp_api.include"]
+}