Module: check_mk
Branch: master
Commit: 12844cbcf32fe3022cf8b9347d6622be7787c629
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=12844cbcf32fe3…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Tue Jul 11 15:38:28 2017 +0200
4916 windows_multipath: Now configurable through agent bakery
Change-Id: I864871a8453ab66b7b9788580dbfda89dfcba15b
---
.werks/4916 | 10 +++++++
checks/windows_multipath | 51 ++++++++++++++++++++++++------------
web/plugins/wato/check_parameters.py | 28 +++++++++++++++++++-
3 files changed, 71 insertions(+), 18 deletions(-)
diff --git a/.werks/4916 b/.werks/4916
new file mode 100644
index 0000000..1d6be51
--- /dev/null
+++ b/.werks/4916
@@ -0,0 +1,10 @@
+Title: windows_multipath: Now configurable through agent bakery
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1499780278
+Class: feature
+
+
diff --git a/checks/windows_multipath b/checks/windows_multipath
index faba5ef..0db8325 100644
--- a/checks/windows_multipath
+++ b/checks/windows_multipath
@@ -30,31 +30,48 @@
#4
# (yes, thats all)
-
def inventory_windows_multipath(info):
if len(info) > 0:
- num_paths = saveint(info[0][0])
- if num_paths > 0:
- return [ (None, num_paths ) ]
+ num_active = int(info[0][0])
+ if num_active> 0:
+ return [ (None, num_active ) ]
return []
def check_windows_multipath(item, params, info):
- num_paths = saveint(info[0][0])
- all_paths = params
-
- # Anything less than 51% of paths is considered crit
- if num_paths == all_paths:
- state = 0
- elif num_paths <= all_paths / 2:
- state = 2
+ num_active = int(info[0][0])
+
+ yield 0, "Paths active: %s" % (num_active)
+
+ if isinstance(params, tuple):
+ num_paths, warn, crit = params
+ warn_num = (warn / 100.0) * num_paths
+ crit_num = (crit / 100.0) * num_paths
+ if num_active < crit_num:
+ state = 2
+ elif num_active < warn_num:
+ state = 1
+ else:
+ state = 0
+
+ if state > 0:
+ yield state, "(warn/crit below %d/%d)" % (warn_num, crit_num)
else:
- state = 1
+ if isinstance(params, int):
+ num_paths = params
+ else:
+ num_paths = 4
+
+ yield 0, "Expected paths: %s" % num_paths
+ if num_active < num_paths:
+ yield 2, "(crit below %d)" % num_paths
+ elif num_active > num_paths:
+ yield 1, "(warn at %d)" % num_paths
- return (state, "paths reported %d, expected paths %d" % (num_paths,
all_paths) + state * "!")
check_info["windows_multipath"] = {
- "check_function" : check_windows_multipath,
- "inventory_function" : inventory_windows_multipath,
- "service_description": "Multipath",
+ "inventory_function" : inventory_windows_multipath,
+ "check_function" : check_windows_multipath,
+ "service_description" : "Multipath",
+ "group" : "windows_multipath",
}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 10855f1..26d3e30 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -10899,7 +10899,33 @@ register_check_parameters(
)
register_check_parameters(
- subgroup_storage,
+ subgroup_storage,
+ "windows_multipath",
+ _("Windows Multipath Count"),
+ Alternative(
+ help = _("This rules sets the expected number of active paths for a
multipath LUN."),
+ title = _("Expected number of active paths"),
+ elements = [
+ Integer(
+ title = _("Expected number of active paths")),
+ Tuple(
+ title = _("Expected percentage of active paths"),
+ elements = [
+ Integer(
+ title = _("Expected number of active paths")),
+ Percentage(
+ title = _("Warning if less then")),
+ Percentage(
+ title = _("Critical if less then")),
+ ]),
+ ]
+ ),
+ None,
+ "first",
+)
+
+register_check_parameters(
+ subgroup_storage,
"multipath",
_("Linux and Solaris Multipath Count"),
Alternative(