Module: check_mk
Branch: master
Commit: 9d258f2d1e434427c208c956d0723b533a711d70
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9d258f2d1e4344…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jan 26 10:06:38 2011 +0100
hpux_multipath: New check for monitoring Multipathing on HP-UX
---
ChangeLog | 1 +
agents/check_mk_agent.hpux | 3 +-
checkman/hpux_multipath | 28 +++++++++++
checks/hpux_multipath | 112 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 143 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b72976a..bba961c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@
* New agent for HP-UX
* hpux_cpu: new check for monitoring CPU load average on HP-UX
* hpux_if: New check for monitoring NICs on HP-UX (compatible to if/if64)
+ * hpux_multipath: New check for monitoring Multipathing on HP-UX
1.1.9i5:
diff --git a/agents/check_mk_agent.hpux b/agents/check_mk_agent.hpux
index 417ba87..ae1e280 100755
--- a/agents/check_mk_agent.hpux
+++ b/agents/check_mk_agent.hpux
@@ -88,7 +88,8 @@ echo '<<<hpux_lvm:sep(58)>>>'
vgdisplay -v -F
# Multipathing
-scsimgr lun_map | egrep '^[[:space:]]*(LUN PATH|State)'
+echo '<<<hpux_multipath>>>'
+scsimgr lun_map | egrep '^[[:space:]]*(LUN PATH|State|World Wide Identifier)'
echo '<<<ntp>>>'
# remove heading, make first column space separated
diff --git a/checkman/hpux_multipath b/checkman/hpux_multipath
new file mode 100644
index 0000000..1dec7ea
--- /dev/null
+++ b/checkman/hpux_multipath
@@ -0,0 +1,28 @@
+title: Check Multipathing on HP-UX
+agents: hpux
+author: Mathias Kettner <mk(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the state of Multipath groups (LUNs) on HP-UX.
+ Each path can be in the state {ACTIVE}, {STANDBY}, {FAILED} or {UNOPEN}.
+ The check parameter specifies the number of pathes expected in the
+ various states (usually active and standby). The check triggers critical,
+ if at least one path is {FAILED}. It triggers a warning if the number
+ of paths in the various states has changed (e.g. if a path has completely
+ vanished or switched from active to standby).
+
+item:
+ The WWID of the LUN.
+
+inventory:
+ On service is created for each LUN that has at least
+ two paths which are not {UNOPEN}. LUNs with all paths
+ in state {UNOPEN} will be ignored. Also LUNs with only
+ one path will be ignored (there are usually local devices).
+
+[parameters]
+active (int): The number of paths expected in state {ACTIVE}
+standby (int): The number of paths expected in state {STANDBY}
+failed (int): The number of paths expected in state {FAILED}
+unopen (int): The number of paths expected in state {UNOPEN}
diff --git a/checks/hpux_multipath b/checks/hpux_multipath
new file mode 100644
index 0000000..c12646a
--- /dev/null
+++ b/checks/hpux_multipath
@@ -0,0 +1,112 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2010 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+# Example output from agent:
+# <<<hpux_multipath>>>
+# LUN PATH INFORMATION FOR LUN : /dev/rtape/tape1_BEST
+# World Wide Identifier(WWID) = 0x600508b4000139e500049000075e0000
+# State = UNOPEN
+# LUN PATH INFORMATION FOR LUN : /dev/rdisk/disk10
+# World Wide Identifier(WWID) = 0x600508b4000139e500009000075e00b0
+# State = ACTIVE
+# LUN PATH INFORMATION FOR LUN : /dev/rdisk/disk13
+# World Wide Identifier(WWID) = 0x600508b4000139e500009000075e00c0
+# State = UNOPEN
+# LUN PATH INFORMATION FOR LUN : /dev/pt/pt2
+# World Wide Identifier(WWID) = 0x600508b4000139e500009000075e00d0
+# State = UNOPEN
+# State = UNOPEN
+# State = UNOPEN
+# State = UNOPEN
+# State = UNOPEN
+# State = UNOPEN
+# State = UNOPEN
+# State = UNOPEN
+# LUN PATH INFORMATION FOR LUN : /dev/rdisk/disk781
+# World Wide Identifier(WWID) = 0x600508b4000139e500009000075e00e0
+# State = ACTIVE
+# State = STANDBY
+# State = FAILED
+# State = FAILED
+# State = ACTIVE
+# State = STANDBY
+# LUN PATH INFORMATION FOR LUN : /dev/rdisk/disk912
+# World Wide Identifier(WWID) = 0x600508b4000139e500009000075e00f0
+# State = ACTIVE
+# State = STANDBY
+# State = ACTIVE
+# State = STANDBY
+
+hpux_multipath_pathstates = { "ACTIVE": 0, "STANDBY": 1,
"FAILED": 2, "UNOPEN": 3 }
+
+def parse_hpux_multipath(info):
+ disks = {}
+ for line in info:
+ if ':' in line:
+ disk = line[-1]
+ elif line[0] == "World":
+ wwid = line[-1]
+ paths = [0,0,0,0] # ACTIVE, STANBY, FAILED, UNOPEN
+ disks[wwid] = (disk, paths)
+ elif '=' in line:
+ state = line[-1]
+ paths[hpux_multipath_pathstates[state]] += 1
+ return disks
+
+def inventory_hpux_multipath(checkname, info):
+ inventory = []
+ disks = parse_hpux_multipath(info)
+ for wwid, (disk, (active, standby, failed, unopen)) in disks.items():
+ if active + standby + failed >= 2:
+ inventory.append((wwid, (active, standby, failed, unopen)))
+ return inventory
+
+def hpux_multipath_format_pathstatus(pathcounts):
+ infos = []
+ for name, i in hpux_multipath_pathstates.items():
+ c = pathcounts[i]
+ if c > 0:
+ infos.append("%d %s" % (c, name))
+ return ", ".join(infos)
+
+def check_hpux_multipath(item, params, info):
+ disks = parse_hpux_multipath(info)
+ if item not in disks:
+ return (3, "UNKNOWN - no LUN with this WWID found")
+ disk, pathcounts = disks[item]
+
+ if pathcounts[2] > 0:
+ return (2, "CRIT - %s: %d failed paths! (%s)" % (disk, pathcounts[2],
hpux_multipath_format_pathstatus(pathcounts)))
+
+ elif list(pathcounts) != list(params):
+ return (1, "WARN - %s: Invalid path status %s (should be %s)" %
+ (disk, hpux_multipath_format_pathstatus(pathcounts),
+ hpux_multipath_format_pathstatus(params)))
+ else:
+ return (0, "OK - %s: %s" % (disk,
hpux_multipath_format_pathstatus(pathcounts)))
+
+
+check_info['hpux_multipath'] = (check_hpux_multipath, "Multipath %s",
0, inventory_hpux_multipath )