Module: check_mk
Branch: master
Commit: b6e0de08afa697b1bf1a42cb11a5b5843d009951
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b6e0de08afa697…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Mon Jan 19 17:50:00 2015 +0100
#1852 FIX solaris_multipath: this check now works with inventory to remember the number of
total paths
Since the current number of total paths has been reported to decrease when paths are lost,
the check
has been modified to remember the total number of paths during inventory and compare the
current number of
active paths with this remembered value. See also: the check man page.
---
.werks/1852 | 11 +++++++++++
ChangeLog | 2 ++
checkman/solaris_multipath | 25 +++++++++++++++++--------
checks/solaris_multipath | 36 +++++++++++++++++++++++-------------
4 files changed, 53 insertions(+), 21 deletions(-)
diff --git a/.werks/1852 b/.werks/1852
new file mode 100644
index 0000000..fa1dea2
--- /dev/null
+++ b/.werks/1852
@@ -0,0 +1,11 @@
+Title: solaris_multipath: this check now works with inventory to remember the number of
total paths
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.7i1
+Date: 1421685959
+Class: fix
+
+Since the current number of total paths has been reported to decrease when paths are
lost, the check
+has been modified to remember the total number of paths during inventory and compare the
current number of
+active paths with this remembered value. See also: the check man page.
diff --git a/ChangeLog b/ChangeLog
index 0cf7f34..9c35fdd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -81,6 +81,8 @@
* 1814 FIX: agent_ibmsvc: Fixed missing executable flag
* 1817 FIX: The Check_MK service did not result in CRITICAL/WARNING states when using
Nagios as core...
* 1844 FIX: oracle_crs_res: fix computation of node a ressource is running on...
+ * 1852 FIX: solaris_multipath: this check now works with inventory to remember the
number of total paths...
+ NOTE: Please refer to the migration notes!
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request,
added mailto link for error report...
diff --git a/checkman/solaris_multipath b/checkman/solaris_multipath
index 6eb2a61..da56a64 100644
--- a/checkman/solaris_multipath
+++ b/checkman/solaris_multipath
@@ -4,18 +4,27 @@ catalog: os/storage
license: GPL
distribution: check_mk
description:
- This check monitors the state of multipathed SCSI devices on
- Solaris 10 systems using the {"mpathadm"} utility.
- It alerts if missing paths are reported by the OS.
- The check will only return a {"WARNING"} if at least 50% of the paths to a
- LUN are working.
- The alert will return {"CRITICAL"} if less than 50% of the paths
- to a LUN are working.
+ This check monitors the state of multipathed SCSI devices on Solaris 10
+ systems using the {"mpathadm"} utility. It alerts if missing paths are
+ reported by the OS.
+
+ Missing paths are determined by comparing the total number of paths with
+ the current number of paths. The total number of paths is taken from the
+ time the last inventory was made.
+
+ The check will return a {"WARNING"} if at least 50% of the paths to
+ a LUN are working. The alert will return {"CRITICAL"} if less than 50%
+ of the paths to a LUN are working.
+
+ The check will also return a {"WARNING"} if the number of total paths was
+ not yet inventorized, or if the number of total paths has increased since
+ last inventory.
item:
A service the WWID of the LUN.
inventory:
- One service is created for each LUN that is reported by mpathadm
+ One service is created for each LUN that is reported by mpathadm. The total
+ number of paths for each created service is also remembered during inventory.
diff --git a/checks/solaris_multipath b/checks/solaris_multipath
index 7c22a33..f5f0210 100644
--- a/checks/solaris_multipath
+++ b/checks/solaris_multipath
@@ -24,31 +24,41 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+# Example output:
# <<<solaris_multipath>>>
# /dev/rdsk/c4t600601608CB02A00DCFD2EEB19A0E111d0s2 4 4
-
def inventory_solaris_multipath(info):
- inventory = []
for device, total, ok in info:
item = device.split('/')[-1]
- inventory.append( (item, None) )
- return inventory
-
+ yield item, '{ "total": %s }' % total
-def check_solaris_multipath(item, _no_params, info):
+def check_solaris_multipath(item, params, info):
for device, total, ok in info:
if item == device.split('/')[-1]:
- total = int(total)
+
+ itotal = params.get("total") # total from last service discovery
ok = int(ok)
- if total == ok:
- 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)
+ total = int(total)
+
+
+ if not itotal:
+ state = 1
+ infotext = "%d of %d paths up, but total paths not yet inventorized,
redo service discovery" % (ok, total)
else:
- return 1, "only %d/%d paths up" % (ok, total)
+ itotal = int(itotal)
+ infotext = "%d of %d paths up" % (ok, itotal)
+ if total > itotal:
+ state = 1
+ infotext += ", but total paths increased to %d, redo service
discovery" % total
+ elif itotal == ok:
+ state = 0
+ elif itotal >= ok * 2: # less than half of paths ok
+ state = 2
+ else:
+ state = 1
- return 3, "Path not found"
+ return state, infotext
check_info["solaris_multipath"] = {