Module: check_mk
Branch: master
Commit: 63b526f83ebfd8df7a25b9a064e228fbeb4577ac
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=63b526f83ebfd8…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Jun 21 09:42:57 2016 +0200
3549 FIX netapp_api_snapshots: now correctly processes offline volumes
Offline volumes do not provide the information the netapp_api_snapshots check requires.
The check now reports an UNKNOWN state whenever the volume state differs from
<i>online</i>.
---
.werks/3549 | 11 +++++++++++
ChangeLog | 1 +
agents/special/agent_netapp | 2 +-
checks/netapp_api_snapshots | 4 ++++
4 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/.werks/3549 b/.werks/3549
new file mode 100644
index 0000000..99e55a4
--- /dev/null
+++ b/.werks/3549
@@ -0,0 +1,11 @@
+Title: netapp_api_snapshots: now correctly processes offline volumes
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i1
+Date: 1466494794
+
+Offline volumes do not provide the information the netapp_api_snapshots check requires.
+The check now reports an UNKNOWN state whenever the volume state differs from
<i>online</i>.
diff --git a/ChangeLog b/ChangeLog
index ed3be01..deeb95e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -276,6 +276,7 @@
* 3144 FIX: bugfix: replacing pipe symbol in plugin output was broken
* 3638 FIX: cisco_qos: fixed wrong unit handling
* 3548 FIX: agent_netapp: fixed agent exception for channels without shelfes.
improved 7mode/clustermode differentation...
+ * 3549 FIX: netapp_api_snapshots: now correctly processes offline volumes...
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/agents/special/agent_netapp b/agents/special/agent_netapp
index 149ac69..618ef6d 100755
--- a/agents/special/agent_netapp
+++ b/agents/special/agent_netapp
@@ -731,7 +731,7 @@ else:
container = NaElement("container")
container.child_add(volume)
print format_config(container, "volume_snapshot", "name",
- config_report = ["name", "size-total",
"snapshot-percent-reserved",
+ config_report = ["name", "size-total",
"snapshot-percent-reserved", "state",
"snapshot-blocks-reserved",
"reserve-used-actual"])
# Protocols
diff --git a/checks/netapp_api_snapshots b/checks/netapp_api_snapshots
index a300ef4..8265b4b 100644
--- a/checks/netapp_api_snapshots
+++ b/checks/netapp_api_snapshots
@@ -43,6 +43,10 @@ def check_netapp_api_snapshots(item, params, parsed):
if not data:
return
+ if data[0].get("state") != "online":
+ yield 3, "No snapshot information available. Volume is %s" %
data[0].get("state")
+ return
+
snapshot_total = int(data[0]["reserve-used-actual"]) * 1024.0
size_total = int(data[0]["size-total"])
reserved_bytes = int(data[0]["snapshot-blocks-reserved"]) * 1024.0