Module: check_mk
Branch: master
Commit: f9405e11c68f8f1d423540de47072397a7b6e88a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f9405e11c68f8f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jan 9 17:41:17 2014 +0100
Internal code cleanup in solaris_multipath check
---
checks/solaris_multipath | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/checks/solaris_multipath b/checks/solaris_multipath
index debf978..9ff6d5e 100644
--- a/checks/solaris_multipath
+++ b/checks/solaris_multipath
@@ -27,22 +27,32 @@
#<<<solaris_multipath>>>
#/dev/rdsk/c4t600601608CB02A00DCFD2EEB19A0E111d0s2 4 4
-def check_solaris_multipath(item, params, info):
- for line in info:
- if line[0].split('/')[-1] == item:
- total, ok = map(int, line[1:3])
+
+def inventory_solaris_multipath(info):
+ inventory = []
+ for device, total, ok in info:
+ item = device.split('/')[-1]
+ inventory.append( (item, None) )
+ return inventory
+
+
+def check_solaris_multipath(item, _no_params, info):
+ for device, total, ok in info:
+ if item == device.split('/')[-1]:
+ total = int(total)
+ ok = int(ok)
if total == ok:
- return(0, "%d paths up" % total)
- elif total > ok and (100 / total) * ok <= 50:
- return(2, "only %d/%d paths up" % (ok, total))
+ return 0, "%d paths up" % total
+ elif float(ok) / total <= 0.5: # critical if only half of paths ok
+ return 2, "only %d/%d paths up" % (ok, total)
else:
- return(1, "only %d/%d paths up" % (ok, total))
+ return 1, "only %d/%d paths up" % (ok, total)
+
+ return 3, "Path not found"
- return(2, "Path not found")
check_info["solaris_multipath"] = {
- "check_function" : check_solaris_multipath,
- "inventory_function" : lambda info: [ (item[0].split('/')[-1], None
) for item in info],
+ "inventory_function" : inventory_solaris_multipath,
+ "check_function" : check_solaris_multipath,
"service_description" : "Multipath %s",
- "has_perfdata" : False
}