您的位置:首页 > 运维架构 > Shell

shell中循环监控MQ当前深度

2016-05-02 21:23 211 查看
在MQ交易,经常时时观察队列情况。如下脚本则是显示某队列深度情况。

新建test.sh 文件,脚本如下:

#!/bin/sh

time1=`date +%m%d%H%M`

sleep_time=10

if [ "$#" != "2" ]

then

echo "usage: queue.sh QManger Queue"

exit 1

fi

echo "--------------------BEGIN--------------------"

echo

start=`date +%s`

while [ 0 ]

do

str=`echo "display queue($2)" | runmqsc $1 | grep "CURDEPTH" | cut -b 3-18`

str1=`date +%H:%M:%S`

echo "${str1}:${1}:${2}:${str}"|tee -a ./queue/req_sp_depth_$time1.log

sleep $sleep_time

done

end=`date +%s`

echo

echo "----------------------END-----------------------------"

运行脚本命令:

test.sh GLMSQMGR GLMS.REQ_GW

第一参数:队列管理器名称

第 二参数:队列名称
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: