Module: check_mk
Branch: master
Commit: fc012630e20f4ca6d0e8e5dcd21acd01defcbe35
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fc012630e20f4c…
Author: Florian Heigl <fh(a)mathias-kettner.de>
Date: Fri Jun 29 16:22:08 2012 +0200
Solaris Agent: Beautify agent and bugfix for solaris_multipath
---
agents/check_mk_agent.solaris | 37 ++++++++++++++++++++++++-------------
checks/solaris_multipath | 8 ++++----
2 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris
index f346cb3..a1bf441 100755
--- a/agents/check_mk_agent.solaris
+++ b/agents/check_mk_agent.solaris
@@ -27,9 +27,8 @@
export LC_ALL=C
unset LANG
-MK_LIBDIR="/change/me"
-MK_CONFDIR="/change/me"
-export MK_LIBDIR MK_CONFDIR
+export MK_LIBDIR="/change/me"
+export MK_CONFDIR="/change/me"
# All executables in PLUGINSDIR will simply be executed and their
# ouput appended to the output of the agent. Plugins define their own
@@ -45,6 +44,20 @@ echo '<<<check_mk>>>'
echo Version: 1.2.0p2
echo AgentOS: solaris
+
+# Find out what type of system we run.
+# A standard Zone that will not have hardware of any kind?
+# A Global Zone with hardware?
+if type zonename > /dev/null 2>&1 ; then
+ if [ `zonename` = "global" ]; then
+ platform="global_zone"
+ else
+ platform="zone"
+else
+# Otherwise we have a normal or hard-partitioned system
+ platform="hardware"
+fi
+
echo '<<<df>>>'
for fs in ufs zfs vxfs
do
@@ -63,15 +76,10 @@ ps -A -o user,vsz,rss,pcpu,args | sed -e 1d -e 's/ *\([^ ]*\) *\([^ ]*\) *\([^ ]
# You need statgrab to be installed. You'll find it
# here: http://www.i-scream.org/libstatgrab/
-# Only collect net stats if we are in a global zone
statgrab_vars="const. cpu. disk. general. mem. page. proc. swap. user."
statgrab_sections="proc cpu disk page"
-if which zonename > /dev/null; then
- if [ "`zonename`" = "global" ]; then
- statgrab_vars="$statgrab_vars .net"
- statgrab_sections="$statgrab_sections net"
- fi
-else
+# Only collect net stats if we aren't in a unpriv. zone.
+if [ "$platform" != "zone" ]; then
statgrab_vars="$statgrab_vars .net"
statgrab_sections="$statgrab_sections net"
fi
@@ -118,13 +126,16 @@ fi
# TCP Connection stats
echo '<<<tcp_conn_stats>>>'
-netstat -nafinet -P tcp | tail +5 | awk '{ c[$7]++; } END { for (x in c) { print x, c[x];}}'
+netstat -nafinet -P tcp | tail +5 | \
+awk '{ c[$7]++; } END { for (x in c) { print x, c[x];}}'
# Multipathing on Solaris10+
-if type mpathadm >/dev/null 2>&1 ; then
+if [ "$platform" != "zone" ]; then
echo '<<<solaris_multipath>>>'
- mpathadm list LU | awk '{if(NR%3==1){dev=$1}if(NR%3==2){tc=$NF}if(NR%3==2){printf "%s %s %s\n",dev,tc,$NF}}'
+ mpathadm list LU | awk '{if(NR%3==1){dev=$1}
+ if(NR%3==2){tc=$NF}
+ if(NR%3==0){printf "%s %s %s\n",dev,tc,$NF}}'
fi
diff --git a/checks/solaris_multipath b/checks/solaris_multipath
index b41cef8..4c46839 100644
--- a/checks/solaris_multipath
+++ b/checks/solaris_multipath
@@ -31,14 +31,14 @@ def check_solaris_multipath(item, params, info):
for line in info:
if line[0].split('/')[-1] == item:
total, ok = map(int, line[1:3])
- if total > ok and (100 / total) * ok <= 50:
- return(2, "CRIT - only %d/%d paths up" % (ok, total))
- elif total == ok:
+ if total == ok:
return(0, "OK - %d paths up" % total)
+ elif total > ok and (100 / total) * ok <= 50:
+ return(2, "CRIT - only %d/%d paths up" % (ok, total))
else:
return(1, "WARN - only %d/%d paths up" % (ok, total))
- return(2, "UKN - Path not found")
+ return(2, "UNKNOWN - Path not found")
check_info["solaris_multipath"] = {
"check_function" : check_solaris_multipath,
Module: check_mk
Branch: master
Commit: 7ea4bc4f68a81dbb3cde5e9941b647eae03e65d1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7ea4bc4f68a81d…
Author: Florian Heigl <fh(a)mathias-kettner.de>
Date: Fri Jun 29 16:13:49 2012 +0200
Check for AIX LVM volumes (only rootvg by default)
---
ChangeLog | 1 +
agents/check_mk_agent.aix | 5 ++
checkman/aix_lvm | 25 +++++++
checks/aix_lvm | 152 +++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 183 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 046a096..dac646e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,7 @@
(thanks to Sebastian Talmon)
* FIX: winperf_phydisk: Fix typo (lead to WATO rule not being applied)
* Windows agent: new [global] option crash_debug (see online docu)
+ * AIX agent: new check for LVM volume status in rootvg.
Multisite:
* Show number of rows and number of selected rows in header line
diff --git a/agents/check_mk_agent.aix b/agents/check_mk_agent.aix
index 8056005..beaa35c 100755
--- a/agents/check_mk_agent.aix
+++ b/agents/check_mk_agent.aix
@@ -95,6 +95,11 @@ fi
echo '<<<aix_multipath>>>'
lspath -F"name parent status"
+echo '<<<aix_lvm>>>'
+ # -L disables LVM lock for the query. Avoids blocking while LVM is
+ # doing changes. For rootvg that is fine.
+ lsvg -L -l rootvg
+
echo '<<<tcp_conn_stats>>>'
netstat -ntfinet | awk ' /^tcp/ { c[$6]++; } END { for (x in c) { print x, c[x]; } }'
diff --git a/checkman/aix_lvm b/checkman/aix_lvm
new file mode 100644
index 0000000..b1510e8
--- /dev/null
+++ b/checkman/aix_lvm
@@ -0,0 +1,25 @@
+title: Check mirror state of LVM logical volumes on HP-UX
+agents: aix
+author: Florian Heigl <fh(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the mirror state of LVM logical volumes in the
+ root volumegroup on AIX.
+
+ It makes sure that all logical volumes are in the the {open,syncd}
+ state. If a LV is in state {closed}, the check will give a {WARN}
+ message to inform you.
+ Exception: LVs of type {boot} are OK if they are in state {closed}
+
+ It detects mirrored LVs and alerts with a {WARN} state, if there are
+ obvious allocation errors, or a {CRIT} state, if the volume state is
+ not {syncd}.
+
+item:
+ The name path of the VG and LV (e.g. {"rootvg/hd10"}).
+
+inventory:
+ On service is created for each logical volume in rootvg.
+ If the agent is modified to report volumes from other volume groups,
+ those will also be monitored.
diff --git a/checks/aix_lvm b/checks/aix_lvm
new file mode 100644
index 0000000..d658ff0
--- /dev/null
+++ b/checks/aix_lvm
@@ -0,0 +1,152 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2012 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.
+
+# Agent output and things to know:
+
+# hd5 boot 1 2 2 closed/syncd N/A
+# hd6 paging 65 130 2 open/syncd N/A
+# hd8 jfs2log 1 2 2 open/syncd N/A
+# hd4 jfs2 1 2 2 open/syncd /
+# hd2 jfs2 5 10 2 open/syncd /usr
+# hd9var jfs2 3 6 2 open/syncd /var
+# hd3 jfs2 2 4 2 open/syncd /tmp
+# hd1 jfs2 1 2 2 open/syncd /home
+# hd10opt jfs2 3 6 2 open/syncd /opt
+# hd11admin jfs2 1 2 2 open/syncd /admin
+# lg_dumplv sysdump 6 6 1 open/syncd N/A
+# livedump jfs2 1 2 2 open/syncd /var/adm/ras/livedump
+# lvwork jfs2 1 2 2 open/syncd /work
+# lvbackup jfs2 200 200 1 open/syncd /backup
+# fwdump jfs2 5 5 1 open/syncd /var/adm/ras/platform
+# lvoracle jfs2 30 30 1 open/syncd /oracle
+
+# hd5 which contains the boot kernel is normally always closed (but it doesn't
+# matter IF it's closed.
+
+# row3: 1 means it alloceted one lvm logical extent (called partition on AIX), so
+# it's likely 256MB in size.
+# row4: 2 means it uses two physical extents. So if it uses two physical for
+# one logical ... yeah, a mirror
+
+# row5: 2 means that the volume uses two physical volumes to store those
+# extents. So the mirror isn't on the same disk if it dies.
+
+# row6: here open/syncd is OK for every active volume
+
+#lvmconf = {
+# rootvg : {
+# hd5 : ("boot", 1, 2, 2, "closed/syncd", None)
+# hd4 : ("/", 1, 2, 2, "open/syncd", "/")
+# }
+#}
+
+def parse_aix_lvm(info):
+ lvmconf = {}
+ for line in info:
+ if len(line) == 1:
+ vgname = line[0][:-1]
+ lvmconf.update({ vgname : {} })
+ else:
+ lv, lvtype, num_lp, num_pp, num_pv, act_state, mountpoint = line
+ # split lv state into two relevant values
+ activation, mirror = act_state.split("/")
+ if mountpoint == "N/A":
+ mountpoint = None
+ lvmconf[vgname].update( {
+ lv : (lvtype, int(num_lp), int(num_pp), int(num_pv),
+ activation, mirror, mountpoint)
+ })
+ return lvmconf
+
+
+def inventory_aix_lvm(info):
+ inventory = []
+ lvmconf = parse_aix_lvm(info)
+ for vg in lvmconf.keys():
+ for lv in lvmconf[vg].keys():
+ #inventory.append(("%s/%s" % (vg, lv), ('%s' % lvmconf[vg][lv][4],)))
+ inventory.append(("%s/%s" % (vg, lv), None))
+ return inventory
+
+
+def check_aix_lvm(item, _no_params, info):
+
+ # Get ready to find our item and settings.
+ #target_activation = params
+ target_vg, target_lv = item.split("/")
+
+ # Get structured LVM info
+ lvmconf = parse_aix_lvm(info)
+
+ if target_lv in lvmconf[target_vg].keys():
+ msgtxt = []
+ state = 0
+
+ lvtype, num_lp, num_pp, num_pv, activation, mirror, mountpoint = lvmconf[target_vg][target_lv]
+
+ # Test if the volume is mirrored.
+ # Yes? Test for an even distribution of PP's over volumes.
+ # This is cannot detect crossover misaligns and other bad practices.
+ if num_pp / num_lp > 1:
+ if not num_pp / num_pv == num_lp:
+ msgtxt.append( "LV Mirrors are misaligned between physical volumes(!)" )
+ state = max(state, 1)
+
+ # If it's not the boot volume I suspect it should be open.
+ # This may need to be changed for some scenarios
+ if lvtype != "boot":
+ if activation != "open": # and activation != target_activation:
+ msgtxt.append("LV is not opened(!)")
+ state = max(state, 1)
+
+ # Detect any, not just mirrored, volumes, that have stale PPs.
+ # This means either a disk write failure causing a mirror to go stale
+ # or some kind of split mirror backup.
+ if mirror != "syncd":
+
+ msgtxt.append("LV is not in sync state(!!)")
+ state = max(state, 2)
+
+ if state == 0:
+ msgtxt = "LV is open/syncd"
+ else:
+ msgtxt = ", ".join(msgtxt)
+ return (state, nagios_state_names[state] + " - " + msgtxt)
+
+
+ return (3, "UNKNOWN - no such volume found")
+
+
+check_info['aix_lvm'] = {
+ "check_function" : check_aix_lvm,
+ "inventory_function" : inventory_aix_lvm,
+ "service_description": "Logical Volume %s",
+ "has_perfdata" : False,
+ # "group" : "",
+ # "default_levels_variable" : "services_default_levels",
+ # first check we have a vendor mib from W&T, then check for the model in their MIB.
+}
+
Module: check_mk
Branch: master
Commit: fdbc1423c654cac68ba3add6d35cf130ad2b8379
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fdbc1423c654ca…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jun 28 17:01:26 2012 +0200
Fixed type in manpage
---
checkman/j4p_performance.mem | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/checkman/j4p_performance.mem b/checkman/j4p_performance.mem
index 91226cc..dc7af58 100644
--- a/checkman/j4p_performance.mem
+++ b/checkman/j4p_performance.mem
@@ -6,7 +6,7 @@ distribution: check_mk
description:
This checks uses the JSON HTTP service of j4p (from jmx4perl) to
monitor the current memory usage of a Java application server like
- Tomcat or JBoss. You can define levels agains the total memory
+ Tomcat or JBoss. You can define levels against the total memory
usage of the Java machine (heap + non heap).
In order for the check to work, you need to load the j4p.war into your