Module: check_mk
Branch: master
Commit: 1b73a3aef7754336bccb3fe6f011a47d7997e8bf
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1b73a3aef77543…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Wed Nov 25 12:12:45 2015 +0100
multipath: added warn and crit levels
---
checks/multipath | 14 ++++++++++++--
checks/solaris_multipath | 14 ++++++++++++--
web/plugins/wato/check_parameters.py | 10 ++++++++--
3 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/checks/multipath b/checks/multipath
index 4d509eb..6ddd4be 100644
--- a/checks/multipath
+++ b/checks/multipath
@@ -312,8 +312,18 @@ def check_multipath(item, target_numpaths, parsed):
if target_numpaths == None:
target_numpaths = 2 # default case: we need two paths
- elif type(target_numpaths) == float:
- target_numpaths = (target_numpaths / 100) * numpaths
+ elif type(target_numpaths) == tuple:
+ warn, crit = target_numpaths
+ warn_num = (warn / 100.0) * numpaths
+ crit_num = (crit / 100.0) * numpaths
+ levels = " (Warning/ Critical at %d/ %d)" % (warn_num, crit_num)
+ info = "%spaths active: %d" % (aliasinfo, numpaths)
+ if numpaths <= crit_num:
+ return 2, info + levels
+ elif numpaths <= warn_num:
+ return 1, info + levels
+ else:
+ return 0, info
info = "%spaths expected: %d, paths active: %d" % (aliasinfo,
target_numpaths, numpaths)
diff --git a/checks/solaris_multipath b/checks/solaris_multipath
index 424cf47..ddb546d 100644
--- a/checks/solaris_multipath
+++ b/checks/solaris_multipath
@@ -52,8 +52,18 @@ def check_solaris_multipath(item, params, info):
state = 1
infotext += ", expected paths unknown, please redo service
discovery"
else:
- if type(params) == float:
- expected = (params / 100) * total
+ if type(params) == tuple:
+ warn, crit = params
+ warn_num = (warn / 100.0) * total
+ crit_num = (crit / 100.0) * total
+ levels = " (Warning/ Critical at %d/ %d)" % (warn_num,
crit_num)
+ info = "paths active: %d" % (operational)
+ if operational <= crit_num:
+ return 2, info + levels
+ elif operational <= warn_num:
+ return 1, info + levels
+ else:
+ return 0, info
else:
expected = int(params) # should be int, just for legacy reasons
if operational > expected:
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 4a124b8..eeb327f 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -6465,8 +6465,14 @@ register_check_parameters(
elements = [
Integer(
title = _("Expected number of active paths")),
- Percentage(
- title = _("Expected percentage of active paths")),
+ Tuple(
+ title = _("Expected percentage of active paths"),
+ elements = [
+ Percentage(
+ title = _("Warning if less then")),
+ Percentage(
+ title = _("Critical if less then")),
+ ]),
]
),
TextAscii(