Module: check_mk
Branch: master
Commit: 7585c365177e56c88c080281c98b02d0b719f680
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7585c365177e56…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Wed Nov 18 16:27:33 2015 +0100
#1303 multipath, solaris_multipath: Level for needed paths can now be specified in
percent
---
.werks/1303 | 9 +++++++++
ChangeLog | 1 +
checks/multipath | 14 ++++++++------
checks/solaris_multipath | 5 ++++-
web/plugins/wato/check_parameters.py | 11 +++++++++--
5 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/.werks/1303 b/.werks/1303
new file mode 100644
index 0000000..4645de3
--- /dev/null
+++ b/.werks/1303
@@ -0,0 +1,9 @@
+Title: multipath, solaris_multipath: Level for needed paths can now be specified in
percent
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1447860323
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index cbb1cf3..b84c16b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -35,6 +35,7 @@
* 2710 arbor_peakflow_sp, arbor_peakflow_sp.cpu_load, arbor_peakflow_sp.disk_usage,
arbor_peakflow_sp.flows, arbor_peakflow_tms, arbor_peakflow_tms.cpu_load,
arbor_peakflow_tms.disk_usage, arbor_peakflow_tms.host_fault, arbor_peakflow_tms.updates,
arbor_pravail, arbor_pravail.cpu_load, arbor_pravail.disk_usage, arbor_pravail.host_fault:
new checks for various arbor devices
* 2711 janitza_umg: added support for umg508...
* 2792 check_mk_agent.aix: now able to use wildcards in the fileinfo.cfg
+ * 1303 multipath, solaris_multipath: Level for needed paths can now be specified in
percent
* 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/checks/multipath b/checks/multipath
index d39a3d4..4d509eb 100644
--- a/checks/multipath
+++ b/checks/multipath
@@ -281,9 +281,6 @@ def inventory_multipath(parsed):
# item is UUID (e.g. '360a9800043346937686f456f59386741') or alias (e.g.
'mpath0')
def check_multipath(item, target_numpaths, parsed):
- if target_numpaths == None:
- target_numpaths = 2 # default case: we need two paths
-
# Keys in parsed are the UUIDs. First assume that we are
# looking for a UUID. Then fall back to aliases
if item in parsed:
@@ -313,14 +310,19 @@ def check_multipath(item, target_numpaths, parsed):
if numbroken > 0:
return (2, "%sbroken paths: %s" % (aliasinfo,
",".join(broken)))
+ if target_numpaths == None:
+ target_numpaths = 2 # default case: we need two paths
+ elif type(target_numpaths) == float:
+ target_numpaths = (target_numpaths / 100) * numpaths
+
info = "%spaths expected: %d, paths active: %d" % (aliasinfo,
target_numpaths, numpaths)
if numpaths < target_numpaths:
- return (2, info)
+ return 2, info
elif numpaths > target_numpaths:
- return (1, info)
+ return 1, info
else:
- return (0, info)
+ return 0, info
check_info["multipath"] = {
'check_function': check_multipath,
diff --git a/checks/solaris_multipath b/checks/solaris_multipath
index 55d8afb..424cf47 100644
--- a/checks/solaris_multipath
+++ b/checks/solaris_multipath
@@ -52,7 +52,10 @@ def check_solaris_multipath(item, params, info):
state = 1
infotext += ", expected paths unknown, please redo service
discovery"
else:
- expected = int(params) # should be int, just for legacy reasons
+ if type(params) == float:
+ expected = (params / 100) * total
+ else:
+ expected = int(params) # should be int, just for legacy reasons
if operational > expected:
state = 1
elif expected == operational:
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 93a4384..4a124b8 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -6458,10 +6458,17 @@ register_check_parameters(
subgroup_storage,
"multipath",
_("Linux and Solaris Multipath Count"),
- Integer(
+ Alternative(
help = _("This rules sets the expected number of active paths for a
multipath LUN "
"on Linux and Solaris hosts"),
- title = _("Expected number of active paths")),
+ title = _("Expected number of active paths"),
+ elements = [
+ Integer(
+ title = _("Expected number of active paths")),
+ Percentage(
+ title = _("Expected percentage of active paths")),
+ ]
+ ),
TextAscii(
title = _("Name of the MP LUN"),
help = _("For Linux multipathing this is either the UUID (e.g. "