Module: check_mk
Branch: master
Commit: af979ec79429482a8c04bc8abc607d7282c250ae
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=af979ec7942948…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Thu Oct 12 10:38:20 2017 +0200
5340 netapp_api_luns: make read-only configurable
The expected output of Netapp LUNs can now be configured
via the existing WATO rule.
Change-Id: Ife7290375bcdcdf649124463e7014df8b59df308
---
.werks/5340 | 11 +++++++++++
checks/netapp_api_luns | 7 +++++--
web/plugins/wato/check_parameters.py | 8 ++++++++
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/.werks/5340 b/.werks/5340
new file mode 100644
index 0000000..041b47c
--- /dev/null
+++ b/.werks/5340
@@ -0,0 +1,11 @@
+Title: netapp_api_luns: make read-only configurable
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1507797378
+Class: feature
+
+The expected output of the read-only options of Netapp
+LUNs can now be configured via the existing WATO rule.
diff --git a/checks/netapp_api_luns b/checks/netapp_api_luns
index 29ff29b..8c37527 100644
--- a/checks/netapp_api_luns
+++ b/checks/netapp_api_luns
@@ -31,6 +31,7 @@ factory_settings["netapp_api_luns_default_levels"] = {
"levels" : (80.0, 90.0), # warn/crit in percent
"trend_range" : 24,
"trend_perfdata" : True, # do send performance data for trends
+ "read_only" : False,
}
def inventory_netapp_api_luns(parsed):
@@ -47,8 +48,10 @@ def check_netapp_api_luns(item, params, parsed):
if lun.get("online") != "true":
yield 2, "LUN is offline"
- if lun.get("read-only") != "false":
- yield 1, "read-only is %s" % lun.get("read-only")
+ read_only = lun.get("read-only") == "true"
+ if read_only != params.get("read_only"):
+ expected = str(params.get("read_only")).lower()
+ yield 1, "read-only is %s (expected: %s)" %
(lun.get("read-only"), expected)
mega = 1024.0 * 1024.0
size_total = int(lun.get("size")) / mega
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 63e50e9..9957480 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -12022,6 +12022,14 @@ register_check_parameters(
title = _("Trend performance data"),
label = _("Enable generation of performance data from
trends"))
),
+ ( "read_only",
+ Checkbox(
+ title = _("LUN is read-only"),
+ help = _("Display a warning if a LUN is not read-only. Without
"
+ "this setting a warning will be displayed if a LUN is
"
+ "read-only."),
+ label = _("Enable"))
+ ),
]
),
TextAscii(title = _("LUN name")),