Module: check_mk
Branch: master
Commit: 784f83073b8c1d4e5cf4dc41e498d13dc5bd7271
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=784f83073b8c1d…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Dec 12 11:56:54 2016 +0100
4157 FIX netapp_api_cluster: fixed None item
Change-Id: Iefa3c91c5f661213b10e1ce69318775fb6e557c7
---
.werks/4157 | 10 ++++++++++
ChangeLog | 1 +
checks/netapp_api_cluster | 10 ++++++++--
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/.werks/4157 b/.werks/4157
new file mode 100644
index 0000000..9d1825a
--- /dev/null
+++ b/.werks/4157
@@ -0,0 +1,10 @@
+Title: netapp_api_cluster: fixed None item
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i3
+Date: 1481540140
+
+
diff --git a/ChangeLog b/ChangeLog
index e71d78a..32789a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -53,6 +53,7 @@
* 4113 FIX: postgres_locks: fixed missing include file
* 4114 FIX: innovaphone_licenses: fixed wrong percentage calculation
* 4115 FIX: mem.linux: fixed missing stack bug in PNP template
+ * 4157 FIX: netapp_api_cluster: fixed None item
Multisite:
* 4070 Added a painter for the service check period
diff --git a/checks/netapp_api_cluster b/checks/netapp_api_cluster
index eb91133..9ca8839 100644
--- a/checks/netapp_api_cluster
+++ b/checks/netapp_api_cluster
@@ -24,6 +24,7 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+
# <<<netapp_api_cluster:sep(9)>>>
# current-time 1443882397
# current-mode non_ha
@@ -34,11 +35,15 @@
# local-in-headswap false
# new-partner-sysid 0
+
def inventory_netapp_api_cluster(info):
data = dict([line for line in info if len(line) == 2])
- if data.get("current-mode", "").lower() != "non_ha": #
non_ha is standalone
+ # non_ha is standalone
+ if data.get("current-mode", "").lower() != "non_ha" and
\
+ data.get("partner") is not None:
return [ (data.get("partner"), {"state":
data.get("state", "").lower()}) ]
+
# Cluster states according to docu:
# connected - Partner is available for takeover
# takeover_scheduled - Partner is down and takeover is scheduled
@@ -58,6 +63,7 @@ def inventory_netapp_api_cluster(info):
# error - There is an error with the system
# User have to compare the return values case-insensitively.
+
def check_netapp_api_cluster(item, params, info):
data = dict([line for line in info if len(line) == 2])
@@ -91,9 +97,9 @@ def check_netapp_api_cluster(item, params, info):
if not had_errors:
yield 0, "Cluster Status OK"
+
check_info["netapp_api_cluster"] = {
'check_function' : check_netapp_api_cluster,
'inventory_function' : inventory_netapp_api_cluster,
'service_description' : 'Cluster with %s',
}
-