当前位置:网站首页>The shell monitors the depth of the IBM MQ queue and scans it three times in 10s. When the depth value exceeds 5 for more than two times, the queue name and depth value are output.
The shell monitors the depth of the IBM MQ queue and scans it three times in 10s. When the depth value exceeds 5 for more than two times, the queue name and depth value are output.
2022-04-23 02:47:00 【XL's Princess】
#!/bin/bash
# **********************************************************
# * Author : JiangJinlong
# * Create time : 2022-03-07 12:08
# * Filename : GetMQCurdepth.sh
# * Description : Get MQ Curdepth
# **********************************************************
# Defining variables variables
# Queue manager name
mq_name="T_QM_105_YTH_510000"
#mq service ip And port
mq_ip_port="192.168.29.129 1414"
# Number of queues
ql_num=2
# Queue depth alarm value
depth=5
# In three scans , The interval between each scan
s_time=3
# Use telnet The protocol checks whether the port is alive
mq_port_status () {
# Create temporary files to store telnet Output file
temp_file=`mktemp port_status.XXX`
[ ! -x /usr/bin/telnet ] && echo "ERROR:telnet not found command" && exit 1
( telnet $mq_ip_port <<EOF quit EOF
) &>$temp_file
# Get the number of queues
num=`echo "dis ql(*)" | runmqsc $mq_name | grep "YTH" | awk -F"(" '{print $2}' | awk -F")" '{print $1}'|sed '1d'|awk 'END{print NR}'`
if egrep "\^]" $temp_file &>>/dev/null;then
if [ $num -eq $ql_num ];then
echo "mqserver status running"
else
echo "ERROR: check mqserver status"
exit 1
fi
else
echo "ERROR: check mqserver status"
exit 1
fi
rm -rf $temp_file
}
# Get the queue depth value
GetMqCurdepth()
{
disql=`echo "dis ql(*)" | runmqsc $mq_name |grep "YTH" | awk -F"(" '{print $2}' | awk -F")" '{print $1}'`
for un in `seq 0 2`
do
for derth in $disql
do
lname=$derth
disderth=`echo "dis ql($derth) CURDEPTH" | runmqsc $mq_name`
sderth=`echo "dis ql($disderth) CURDEPTH" | runmqsc $mq_name | grep "CURDEPTH" | grep -v "dis" | cut -d '(' -f2 |cut -d ')' -f1`
abc=`echo $sderth | cut -d ']' -f6 | cut -d 'C' -f1 | awk '{gsub(/^\s+|\s+$/, "");print}'`
if [ $abc -gt $depth ]
then
eval $lname[$un]=$abc
fi
under=`expr $un + 1`
echo "$lname The first $under Second depth scan :$abc"
done
sleep $s_time
done
for th in $disql
do
eval 'length="${'"#$th[*]"'}"'
if [ $length -ge 2 ]
then
eval 'echo "ERROR: Queue name :$th \033[0m Two or more of the three depth value monitoring of the queue are too large , Respectively :${'"$th[*]"'}"'
fi
done
}
mq_port_status
GetMqCurdepth
版权声明
本文为[XL's Princess]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220741454962.html
边栏推荐
- Rhcsa day 3 operation
- [wechat applet] set the bottom menu (tabbar) for the applet
- Rhcsa day 1 operation
- Efficient music format conversion tool Music Converter Pro
- JVM类加载器
- Slave should be able to synchronize with the master in tests/integration/replication-psync. tcl
- B blocks of the 46th ICPC Asian regional competition (Kunming)
- Interim summary (Introduction + application layer + transportation layer)
- 基于多态的职工管理系统源码与一些理解
- Leetcode cooking
猜你喜欢
随机推荐
C language 171 Number of recent palindromes
字符串去掉空格问题
16、 Anomaly detection
Use of go language web Middleware
JVM运行时数据区(一)
Intelligent agricultural management model
基于Torchserve部署SBERT模型<语义相似度任务>
Yes, from today on, our fans can participate in Netease data analysis training camp for free!
Airtrack cracking wireless network password (Dictionary running method)
How big the program development of single chip microcomputer project can be, it represents your level of knocking code
Windows MySQL 8 zip installation
OCR识别PDF文件
Halo open source project learning (I): project launch
Deploying sbert model based on torchserve < semantic similarity task >
国产轻量级看板式Scrum敏捷项目管理工具
leetcode 烹饪料理
How to build an integrated industrial Internet plus hazardous safety production management platform?
Essential qualities of advanced programmers
What is the difference between varchar and char?
Store consumption SMS notification template









