Module: check_mk
Branch: master
Commit: 3072214de573f020a1f7a8a796b0a62b2d3f6041
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3072214de573f0…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Feb 5 12:20:00 2016 +0100
#2989 netapp_api_snapshots: increased performance while querying data. levels
configurable
The agent_netapp now uses a more performant command to query this data.
Furthermore you can now configure levels for the used snapshot reserved and
the state when no snapshot reserve is set.
---
.werks/2989 | 11 +++++++++++
ChangeLog | 1 +
agents/special/agent_netapp | 21 +++++----------------
checks/netapp_api_snapshots | 29 +++++++++++++++++++++--------
web/plugins/wato/check_parameters.py | 24 ++++++++++++++++++++++++
5 files changed, 62 insertions(+), 24 deletions(-)
diff --git a/.werks/2989 b/.werks/2989
new file mode 100644
index 0000000..df80415
--- /dev/null
+++ b/.werks/2989
@@ -0,0 +1,11 @@
+Title: netapp_api_snapshots: increased performance while querying data. levels
configurable
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1454671076
+Class: feature
+
+The agent_netapp now uses a more performant command to query this data.
+Furthermore you can now configure levels for the used snapshot reserved and
+the state when no snapshot reserve is set.
diff --git a/ChangeLog b/ChangeLog
index cca00e5..531ff1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -109,6 +109,7 @@
* 3067 openhardwaremonitor.smart: initial support for S.M.A.R.T. harddisk health
monitoring via OpenHardwareMonitor...
* 2975 mk_jolokia: now supports HTTPS
* 2976 eltek_battery, eltek_battery.temp, eltek_battery.supply, eltek_fans,
eltek_outdoor_temp, eltek_systemstatus: new checks for a Eltek Valere USV
+ * 2989 netapp_api_snapshots: increased performance while querying data. levels
configurable...
* 2660 FIX: fixed windows agent using the wrong working directory...
* 2664 FIX: ps: Speedup in situation with many matching processes...
* 2661 FIX: windows agent: fixed incomplete process list...
diff --git a/agents/special/agent_netapp b/agents/special/agent_netapp
index ea614f4..c15f4b4 100755
--- a/agents/special/agent_netapp
+++ b/agents/special/agent_netapp
@@ -670,22 +670,11 @@ else:
# 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 = {}
- 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")
-
- volume_snapshots = server.invoke("snapshot-list-info",
"target-name", name, "target-type", "volume")
- snapshots_elements = volume_snapshots.child_get("snapshots")
- if snapshots_elements:
- print format_dict(dict_reserved, prefix = "volume_snapshot %s" %
name, as_line = True)
- print format_config(snapshots_elements, "volume_snapshot", name,
- config_report = ["volume_snapshot",
"percentage-of-total-blocks", "cumulative-total"])
-
+ container = NaElement("container")
+ container.child_add(volume)
+ print format_config(container, "volume_snapshot", "name",
+ config_report = ["name", "size-total",
"snapshot-percent-reserved",
+ "snapshot-blocks-reserved",
"reserve-used-actual"])
# Protocols
print "<<<netapp_api_protocol:sep(9)>>>"
diff --git a/checks/netapp_api_snapshots b/checks/netapp_api_snapshots
index 405a39b..73ce038 100644
--- a/checks/netapp_api_snapshots
+++ b/checks/netapp_api_snapshots
@@ -29,35 +29,46 @@
# volume_snapshot volch150 percent-reserved 22 blocks-reserved 3322 size-total
12122 ...
# volume_snapshot volch150 percentage-of-total-blocks 0 cumulative-total 122924 ...
+factory_settings["netapp_api_snapshots_default_levels"] = {
+ "levels" : (85.0, 90.0)
+}
+
def inventory_netapp_api_snapshots(parsed):
for key in parsed.keys():
yield key, {}
-def check_netapp_api_snapshots(item, _no_params, parsed):
+def check_netapp_api_snapshots(item, params, parsed):
data = parsed.get(item)
if not data:
return
- snapshot_total = int(data[-1]["cumulative-total"]) * 1024.0
+ snapshot_total = int(data[0]["reserve-used-actual"]) * 1024.0
size_total = int(data[0]["size-total"])
- reserved_bytes = int(data[0]["blocks-reserved"]) * 1024.0
+ reserved_bytes = int(data[0]["snapshot-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"
+ yield params.get("state_noreserve", 1), "No snapshot reserve
configured"
return
used_percent = snapshot_total / reserved_bytes * 100.0
volume_total = size_total + reserved_bytes
state = 0
- if used_percent > 100:
+
+ warn, crit = params.get("levels")
+ if used_percent >= crit:
state = 2
- yield state, "Reserve used: %.1f%% (%s)" % (used_percent,
-
get_bytes_human_readable(snapshot_total))
+ elif used_percent >= warn:
+ state = 1
+
+ extra_info = state and "(Levels at %d%%/%d%%)" % (warn, crit) or
""
+
+ yield state, "Reserve used: %.1f%% (%s)%s" % (used_percent,
+ get_bytes_human_readable(snapshot_total),
extra_info)
- yield 0, "Total Reserve: %s%% (%s) of %s" %
(data[0]["percent-reserved"],
+ yield 0, "Total Reserve: %s%% (%s) of %s" %
(data[0]["snapshot-percent-reserved"],
get_bytes_human_readable(reserved_bytes),
get_bytes_human_readable(volume_total)),\
[("bytes", snapshot_total, 0,
0, 0, reserved_bytes)]
@@ -67,7 +78,9 @@ check_info["netapp_api_snapshots"] = {
custom_keys = ["volume_snapshot"], as_dict_list
= True),
'check_function' : check_netapp_api_snapshots,
'inventory_function' : inventory_netapp_api_snapshots,
+ "default_levels_variable" :
"netapp_api_snapshots_default_levels",
'service_description' : 'Snapshots Volume',
+ 'group' : "netapp_snapshots",
'has_perfdata' : True,
'includes' : ["netapp_api.include"]
}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index fb07e44..40b9fb3 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -7349,6 +7349,30 @@ register_check_parameters(
register_check_parameters(
subgroup_storage,
+ "netapp_snapshots",
+ _("NetApp Snapshot Reserve"),
+ Dictionary(
+ elements = [
+ ( "levels",
+ Tuple(
+ title = _("Levels for used configured reserve"),
+ elements = [
+ Percentage(title = _("Warning at or above"), unit =
"%", default_value = 85.0),
+ Percentage(title = _("Critical at or above"), unit =
"%", default_value = 90.0),
+ ]
+ )),
+ ( "state_noreserve",
+ MonitoringState(
+ title = _("State if no reserve is configured"),
+ )),
+ ],
+ ),
+ TextAscii(title = _("Volume name")),
+ match_type = "dict",
+)
+
+register_check_parameters(
+ subgroup_storage,
"netapp_disks",
_("Filer Disk Levels (NetApp, IBM SVC)"),
Transform(