Module: check_mk
Branch: master
Commit: a017c054631e765dbdac0b9567ae4231f963a93f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a017c054631e76…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Nov 2 16:43:31 2015 +0100
netapp_api_snapshots: fixed broken check/agent output
---
agents/special/agent_netapp | 10 +++++++---
checks/netapp_api_snapshots | 15 +++++++++++----
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/agents/special/agent_netapp b/agents/special/agent_netapp
index a0e9d5b..a5c6ca2 100755
--- a/agents/special/agent_netapp
+++ b/agents/special/agent_netapp
@@ -620,17 +620,21 @@ else:
config_report = ["name", "size-total",
"size-available"])
# Snapshot info
+ print "<<<netapp_api_snapshots:sep(9)>>>"
for volume in volumes.children_get():
name = volume.child_get_string("name")
volume_snapshots_reserved = server.invoke("snapshot-get-reserve",
"volume", name)
- dict_reserved = create_dict(volume_snapshots_reserved)
- dict_reserved["size-total"] =
volume.child_get_string("size-total")
+
+ dict_reserved = {}
+ dict_reserved["size-total"] =
volume.child_get_string("size-total")
+ dict_reserved["percent-reserved"] =
volume_snapshots_reserved.child_get_string("percent-reserved")
+ dict_reserved["blocks-reserved"] =
volume_snapshots_reserved.child_get_string("blocks-reserved")
print format_dict(dict_reserved, prefix = "volume_snapshot %s" % name,
as_line = True)
volume_snapshots = server.invoke("snapshot-list-info",
"target-name", name, "target-type", "volume")
print format_config(volume_snapshots.child_get("snapshots"),
"volume_snapshot", name,
- report = ["volume_snapshot",
"percentage-of-total-blocks", "cumulative-total"])
+ config_report = ["volume_snapshot",
"percentage-of-total-blocks", "cumulative-total"])
# Protocols
diff --git a/checks/netapp_api_snapshots b/checks/netapp_api_snapshots
index ed5fd58..405a39b 100644
--- a/checks/netapp_api_snapshots
+++ b/checks/netapp_api_snapshots
@@ -41,18 +41,25 @@ def check_netapp_api_snapshots(item, _no_params, parsed):
snapshot_total = int(data[-1]["cumulative-total"]) * 1024.0
size_total = int(data[0]["size-total"])
- reserved_percent = snapshot_total / size_total
reserved_bytes = int(data[0]["blocks-reserved"]) * 1024.0
+ if not reserved_bytes:
+ yield 0, "Used snapshot space: %s" %
get_bytes_human_readable(snapshot_total),[("bytes", snapshot_total)]
+ yield 1, "No snapshot reserve configured"
+ return
+
+ used_percent = snapshot_total / reserved_bytes * 100.0
+ volume_total = size_total + reserved_bytes
+
state = 0
- if reserved_percent > 100:
+ if used_percent > 100:
state = 2
- yield state, "Reserve used: %.1f%% (%s)" % (reserved_percent,
+ yield state, "Reserve used: %.1f%% (%s)" % (used_percent,
get_bytes_human_readable(snapshot_total))
yield 0, "Total Reserve: %s%% (%s) of %s" %
(data[0]["percent-reserved"],
get_bytes_human_readable(reserved_bytes),
- get_bytes_human_readable(size_total)),\
+
get_bytes_human_readable(volume_total)),\
[("bytes", snapshot_total, 0,
0, 0, reserved_bytes)]
check_info["netapp_api_snapshots"] = {