当前位置:网站首页>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
边栏推荐
- JZ22 链表中倒数最后k个结点
- The problem of removing spaces from strings
- The penultimate K nodes in jz22 linked list
- Log4j knowledge point record
- JVM类加载器
- Web learning record (medium)
- Cuisine leetcode
- Classification and regression tree of machine learning
- How big the program development of single chip microcomputer project can be, it represents your level of knocking code
- 本地远程访问云服务器的jupyter
猜你喜欢
Six very 6 computer driver managers: what software is good for driver upgrade? Recommended by the best computer driver management software abroad
打靶narak
php+mysql對下拉框搜索的內容修改
基于Torchserve部署SBERT模型<语义相似度任务>
Flink stream processing engine system learning (II)
[unity3d] rolling barrage effect in live broadcasting room
谷雨
Solve the problem that PowerShell mining occupies 100% of cpu7 in win7
基于多态的职工管理系统源码与一些理解
Domestic lightweight Kanban scrum agile project management tool
随机推荐
1、 Sequence model
Huashu "deep learning" and code implementation: 01 Linear Algebra: basic concepts + code implementation basic operations
JZ35 replication of complex linked list
【工欲善其事必先利其器】论文编辑及文献管理(Endnote,Latex,JabRef ,overleaf)资源下载及使用指南
Looking for a job, writing a resume to an interview, this set of information is enough!
工业互联网+危化安全生产综合管理平台怎样建
魔王冷饭||#078 魔王答上海、南京行情;沟通指导;得国和打杀筛选;赚钱的目的;改变别人看法
JDBC JDBC
How to prevent leakage of operation and maintenance data
Efficient music format conversion tool Music Converter Pro
Modification du contenu de la recherche dans la boîte déroulante par PHP + MySQL
How to build an integrated industrial Internet plus hazardous safety production management platform?
How can enterprises with major hazard installations ensure the completion of the digital construction task of double prevention mechanism by the end of the year
重大危险源企业如何保障年底前完成双预防机制数字化建设任务
Flink learning (XI) watermark
Classification and regression tree of machine learning
Intelligent agricultural management model
JVM class loader
Linux redis - redis ha sentinel cluster construction details & redis master-slave deployment
进阶上将程序员必备素质