转:http://phpor.net/blog/post/973
1. 查看mq阻塞情况
sh mq_watch.sh block 10.55.38.24 22202 qname
2. 查看mq写入情况
sh mq_watch.sh write 10.55.38.24 22202 qname
3. 查看mq消费情况
sh mq_watch.sh read 10.55.38.24 22202 qname
mq_watch.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
|
#!/bin/sh
type=$1
host=$2
port=$3
queue=$4
function help() {
echo -e "Usage:\n\tsh $0 type host port queue_name"
echo -e "\t\ttype: [block | write | read]"
echo -e "\teg: sh $0 state 10.55.38.44 22202 test"
}
case "x$type" in
"xblock")
while :; do
echo -ne "stats queue\r\nquit\r\n"|nc $host $port| grep $queue| awk '{print $3;}'| awk -F"/" '{print $1-$2;}'
sleep 1
done
;;
"xwrite")
while :; do
echo -ne "stats queue\r\nquit\r\n"|nc $host $port| grep $queue| awk '{print $3;}'| awk -F"/" '{print $1;}'
sleep 1
done| awk '{print $1-old;old=$1;}'
;;
"xread")
while :; do
echo -ne "stats queue\r\nquit\r\n"|nc $host $port| grep $queue| awk '{print $3;}'| awk -F"/" '{print $2;}'
sleep 1
done| awk '{print $1-old;old=$1;}'
;;
*)
help
;;
esac
|