Module: check_mk
Branch: master
Commit: d7115ad0f0a9e2ec848faa5884f7cd96d70ae93a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d7115ad0f0a9e2…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jan 26 11:37:43 2011 +0100
new check for monitoring HP-UX Serviceguard
---
ChangeLog | 1 +
agents/check_mk_agent.hpux | 6 ++++
checkman/hpux_serviceguard | 21 +++++++++++++
checks/hpux_serviceguard | 69 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 97 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a4bbbf6..881964d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,7 @@
* hpux_if: New check for monitoring NICs on HP-UX (compatible to if/if64)
* hpux_multipath: New check for monitoring Multipathing on HP-UX
* hpux_lvm: New check for monitoring LVM mirror state on HP-UX
+ * hpux_serviceguard: new check for monitoring HP-UX Serviceguard
1.1.9i5:
diff --git a/agents/check_mk_agent.hpux b/agents/check_mk_agent.hpux
index ae1e280..5fc955b 100755
--- a/agents/check_mk_agent.hpux
+++ b/agents/check_mk_agent.hpux
@@ -91,6 +91,12 @@ vgdisplay -v -F
echo '<<<hpux_multipath>>>'
scsimgr lun_map | egrep '^[[:space:]]*(LUN PATH|State|World Wide Identifier)'
+echo '<<<hpux_serviceguard:sep(124)>>>'
+if type cmviewcl >/dev/null 2>&1
+then
+ cmviewcl -v -f line | grep summary
+fi
+
echo '<<<ntp>>>'
# remove heading, make first column space separated
ntpq -p | sed -e 1,2d -e 's/^\(.\)/\1 /' -e 's/^ /%/'
diff --git a/checkman/hpux_serviceguard b/checkman/hpux_serviceguard
new file mode 100644
index 0000000..68cac6a
--- /dev/null
+++ b/checkman/hpux_serviceguard
@@ -0,0 +1,21 @@
+title: Check status of HP-UX Serviveguard
+agents: hpux
+author: Mathias Kettner <mk(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the summary states of HP-UX Serviceguard: the overal
+ state, the states of the nodes and the state of all packages.
+
+ The check gets OK if the state is {ok}, WARN if the state is {degraded}
+ and CRIT in all other cases.
+
+item:
+ {None} for the overal state, {"node:hgs-sd1-srv1"} for the
+ state of the node {hgs-sd1-srv1} and {"package:ADBP"} for the
+ package {ADBP}.
+
+inventory:
+ One separate service for the overal state, for each node
+ and for each package is created.
+
diff --git a/checks/hpux_serviceguard b/checks/hpux_serviceguard
new file mode 100644
index 0000000..ad01f08
--- /dev/null
+++ b/checks/hpux_serviceguard
@@ -0,0 +1,69 @@
+#!/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.
+
+# <<<hpux_serviceguard:sep(124)>>>
+# summary=degraded
+# node:hgs-sd1-srv2|summary=ok
+# node:hgs-sd1-srv1|summary=ok
+# node:hgs-sd2-srv1|summary=ok
+# package:AKKP|summary=degraded
+# package:ADBP|summary=degraded
+# package:ADBT|summary=degraded
+# package:KORRP|summary=degraded
+# package:KVNAP|summary=degraded
+# package:ARCP|summary=degraded
+# package:AKKT|summary=degraded
+# package:AVDT|summary=degraded
+# package:KVNAB|summary=degraded
+# package:AVDP|summary=degraded
+# package:SDBP|summary=degraded
+
+def inventory_hpux_serviceguard(checkname, info):
+ inventory = []
+ for line in info:
+ if len(line) == 1:
+ item = "Total Status"
+ else:
+ item = line[0]
+ inventory.append((item, None))
+ return inventory
+
+def check_hpux_serviceguard(item, params, info):
+ for line in info:
+ if (item == "Total Status" and len(line) == 1) or \
+ (item == line[0] and len(line) == 2):
+ status = line[-1].split("=")[-1]
+ if status == "ok":
+ code = 0
+ elif status == "degraded":
+ code = 1
+ else:
+ code = 2
+ return (code, nagios_state_names[code] + " - state is %s" %
status)
+
+ return (3, "UNKNOWN - No such item found")
+
+check_info['hpux_serviceguard'] = (check_hpux_serviceguard,
"Serviceguard", 0, inventory_hpux_serviceguard )