Module: check_mk
Branch: master
Commit: 2d4a5b713270e14715db065b88402d00964ca70c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2d4a5b713270e1…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Jun 28 16:59:40 2017 +0200
Added werk 4881
Change-Id: Icf056126b36ed9c3ad0178256eda9cfdaa1babdd
---
.werks/4881 | 10 ++++++++++
checks/multipath | 33 ++++++++++++++++-----------------
2 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/.werks/4881 b/.werks/4881
new file mode 100644
index 0000000..6d9dff3
--- /dev/null
+++ b/.werks/4881
@@ -0,0 +1,10 @@
+Title: multipath: Fixed service details: Number of paths were interpreted as expected
paths
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1498660809
+Class: fix
+
+
diff --git a/checks/multipath b/checks/multipath
index 9e68d0f..14a6403 100644
--- a/checks/multipath
+++ b/checks/multipath
@@ -142,12 +142,6 @@ inventory_multipath_rules = []
# `-+- policy='round-robin 0' prio=0 status=enabled
# `- 20:0:0:1 sdi 8:128 active undef running
-# Here another one from Dell
-# Dell_Internal_Dual_SD_0123456789AB-0:0 dm-2 Dell ,Internal Dual SD
-# size=972M features='0' hwhandler='0' wp=rw
-# `-+- policy='service-time 0' prio=0 status=active
-# `- 1:0:0:0 sdb 8:16 active undef running
-
# And a completely new situation:
# <<<multipath>>>
# Nov 05 17:17:03 | DM multipath kernel driver not loaded
@@ -309,9 +303,9 @@ def check_multipath(item, params, parsed):
uuid = mmap.get('uuid')
if item == uuid and alias:
- aliasinfo = "(%s):" % alias
+ aliasinfo = "(%s): " % alias
elif item == alias and uuid:
- aliasinfo = "(%s):" % uuid
+ aliasinfo = "(%s): " % uuid
else:
aliasinfo = ""
@@ -321,39 +315,44 @@ def check_multipath(item, params, parsed):
num_broken = len(broken_paths)
num_active = num_paths - num_broken
- yield 0, "%s paths active: %s, expected paths: %d" % \
- (aliasinfo, num_active, num_paths)
+ infotext = "%sPaths active: %s/%s" % \
+ (aliasinfo, num_active, num_paths)
if isinstance(params, tuple):
warn, crit = params
warn_num = (warn / 100.0) * num_paths
crit_num = (crit / 100.0) * num_paths
- if num_active <= crit_num:
+ if num_active < crit_num:
state = 2
- elif num_active <= warn_num:
+ elif num_active < warn_num:
state = 1
else:
state = 0
if state > 0:
- yield state, "(warn, crit at %d/%d)" % (warn_num, crit_num)
+ infotext += " (warn/crit below %d/%d)" % (warn_num, crit_num)
+ yield state, infotext
+
else:
if isinstance(params, int):
expected_paths = params
else:
expected_paths = 2
+
+ infotext += ", Expected paths: %s" % expected_paths
if num_active < expected_paths:
state = 2
+ infotext += " (crit below %d)" % expected_paths
elif num_active > expected_paths:
state = 1
+ infotext += " (crit at %d)" % expected_paths
else:
state = 0
-
- if state > 0:
- yield state, "(crit if less than %d)" % expected_paths
+ yield state, infotext
if num_broken > 0:
- yield 0, "broken paths: %s" % ",".join(broken_paths)
+ yield 0, "Broken paths: %s" % ",".join(broken_paths)
+
check_info["multipath"] = {
'check_function' : check_multipath,