3 # WWI Version 18.05.2016
4 # +------------------------------------------------------------------+
5 # | ____ _ _ __ __ _ __ |
6 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
7 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
8 # | | |___| | | | __/ (__| < | | | | . \ |
9 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
11 # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
12 # +------------------------------------------------------------------+
14 # This file is part of Check_MK.
15 # The official homepage is at http://mathias-kettner.de/check_mk.
17 # check_mk is free software; you can redistribute it and/or modify it
18 # under the terms of the GNU General Public License as published by
19 # the Free Software Foundation in version 2. check_mk is distributed
20 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
21 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
22 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
23 # tails. You should have received a copy of the GNU General Public
24 # License along with GNU Make; see the file COPYING. If not, write
25 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
26 # Boston, MA 02110-1301 USA.
28 # plugin for websphere_mq_* checks
32 # wwi --------------------------------------
34 # preventing a faulty "TCP Connection" section of the main agent
35 # by using the "-" option, the AIX environment show's the message "[YOU HAVE NEW MAIL]"
36 # before the section start: <<<websphere_mq_channels>>>
37 # so the next section will be useless for the OMD server check.
38 # su - mqm -c "/usr/lib/check_mk_agent/plugins/websphere_mq run"
39 su mqm
-c "/usr/lib/check_mk_agent/plugins/websphere_mq run"
42 # Loop over all local mq instances
43 for QM
in $
( ps
-ef|
grep [/]usr
/mqm
/bin
/runmqlsr|
awk -v FS
="-m" '{print $2}'|
awk '{print $1}'|
uniq)
45 echo '<<<websphere_mq_channels>>>'
46 for i
in `echo " display CHANNEL (*) TYPE (SDR) " | /usr/bin/runmqsc $QM | grep CHLTYPE | \
47 grep -v SYSTEM | awk '{print $1}'`; do
49 j
=`echo "display $i " | /usr/bin/runmqsc $QM | grep XMITQ | tr " " "\n" | \
50 grep XMITQ | sed '1,$s/(/ /g' | sed '1,$s/)/ /g'| awk '{print $2 }'`
52 a
=`echo " display qlocal ($j) CURDEPTH " | /usr/bin/runmqsc $QM | grep CURDEPTH | \
53 tr " " "\n" | grep CURDEPTH | sed '1,$s/(/ /g' | sed '1,$s/)/ /g'| \
54 awk '{print $2 }' | tr "\n" " "`
56 c
=`echo " display qlocal ($j) MAXDEPTH " | /usr/bin/runmqsc $QM | grep MAXDEPTH | \
57 tr " " "\n" | grep MAXDEPTH | sed '1,$s/(/ /g' | sed '1,$s/)/ /g'| \
58 awk '{print $2 }' | tr "\n" " "`
60 l
=`echo $i | sed '1,$s/(/ /g' | sed '1,$s/)/ /g'| awk '{print $2 }'`
62 s
=`echo " display chstatus($l)" | /usr/bin/runmqsc $QM | grep STATUS | tail -1 | \
63 sed '1,$s/(/ /g' | sed '1,$s/)/ /g'| awk '{print $NF }'`
72 echo '<<<websphere_mq_queues>>>'
73 for t
in `echo " display queue (*) where (USAGE EQ NORMAL) " | /usr/bin/runmqsc $QM | \
74 grep -v SYSTEM | grep -v MQMON | grep -v MONITOR | grep -v _T0 | grep -v _T1 | \
75 grep -v _T2 | grep -v _T3 | grep -v mqtest | grep QUEUE | awk '{ print $1 }' | \
76 sed '1,$s/(/ /g' | sed '1,$s/)/ /g'| awk '{print $2 }'`; do
78 # wwi MQ admin change, to get more queues which are needed
79 a
=`echo " display qlocal ($t) CURDEPTH " | /usr/bin/runmqsc $QM | grep CURDEPTH | \
80 tr " " "\n" | grep CURDEPTH | sed '1,$s/(/ /g' | sed '1,$s/)/ /g'| \
81 awk '{print $2 }' | tr "\n" " "`
83 b
=`echo " display qlocal ($t) MAXDEPTH " | /usr/bin/runmqsc $QM | grep MAXDEPTH | \
84 tr " " "\n" | grep MAXDEPTH | sed '1,$s/(/ /g' | sed '1,$s/)/ /g'| \
85 awk '{print $2 }' | tr "\n" " "`
87 c
=`echo " dis qs($t) monitor " | /usr/bin/runmqsc $QM | grep -e LGETDATE -e LGETTIME | \
88 tr '\n' ' '| awk -v FS="LPUTDATE" '{print $1}'|sed 's/ //g'`
90 NOW
=$
(date +%Y_
%m_
%d
"-"%H_
%M_
%S
)
92 # Muster: Anzahl eingehender Messages $a auf $t Max-Queues $b
93 # wwi -------------------------
95 if [ "$a" == "" ] ||
[ "$a" == " " ]; then
98 c
="CURDEPTH(0)LGETDATE()LGETTIME()"
101 if [ "$b" == "" ]||
[ "$b" == " " ]; then
103 c
="CURDEPTH(0)LGETDATE()LGETTIME()"
106 if [ "$c" == "" ]||
[ "$c" == " " ]; then
107 c
="CURDEPTH(0)LGETDATE()LGETTIME()"
110 echo "$a $t $b $c $NOW"
116 if type dspmq
> /dev
/null
; then
117 echo "<<<websphere_mq_instance:sep(41)>>>"
119 echo "MQv"$
(dspmqver|
grep -e Version
-e ^Level
-e Mode|
awk -v FS
=":" '{print $2","}'|
tr -d ' '|
tr -d '\n'|
sed 's/,$/;/g')