forked from ibm-messaging/mq-uniform-clusters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshowConns.sh
executable file
·48 lines (42 loc) · 1.6 KB
/
showConns.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# © Copyright IBM Corporation 2020
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script simply queries a queue manager for the connections and displays them
# This helps see when applications are rebalanced across a Uniform Cluster
# Provide the queue manager name to monitor on the command line
if [ $# -eq 0 ]; then
echo "Provide the queue manager name to monitor"
exit
fi
qmgr=$1
# Check that the queue manager name is valid and available
if [ $(dspmq -m $qmgr | grep '(Running)' | wc -w) -eq 0 ]; then
echo "$qmgr not available"
exit
fi
# Optionally you can override the application name to monitor
app_name=${2:-amqsghac}
# And the time between updates
delay=${3:-1s}
for (( i=0; i<100000; ++i)); do
# First count up the number of matching connections
conn_count=`echo "dis conn(*) where(appltag eq '$app_name')" | runmqsc $qmgr | grep " CONN" | wc -w`
clear
echo -e "$qmgr / ${green}$app_name -- $conn_count"
# Display an entry for each matching connection
echo "dis conn(*) where(appltag eq '$app_name')" | runmqsc $qmgr | grep " CONN"
# Wait before repeating
sleep $delay
done