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#!/bin/sh
#
#Description: get activemq data
IP=192.168.0.139
PORT=8161
QUEUENAME=q.virtual.charge
#WARN_Queuename="DLQ.q.virtual.charge"
WARN_Queuename="DLQ.*"
Warn_Pending=`curl -uadmin:admin http://$IP:$PORT/admin/queues.jsp | grep -A 5 "${WARN_Queuename}"|awk -F '//g'|grep '^[0-9]'|head -1`
Pending=`curl -uadmin:admin http://$IP:$PORT/admin/queues.jsp | grep -A 5 "${QUEUENAME}"|awk -F '//g'|grep '^[0-9]'|head -1`
Consumers=`curl -uadmin:admin http://$IP:$PORT/admin/queues.jsp | grep -A 5 "${QUEUENAME}"|awk -F '//g'|grep '^[0-9]'|head -2|tail -1`
Enqueued=`curl -uadmin:admin http://$IP:$PORT/admin/queues.jsp | grep -A 5 "${QUEUENAME}"|awk -F '//g'|grep '^[0-9]'|head -3|tail -1`
Dequeued=`curl -uadmin:admin http://$IP:$PORT/admin/queues.jsp | grep -A 5 "${QUEUENAME}"|awk -F '//g'|grep '^[0-9]'|head -3|tail -1`
case $1 in
Warn_Pending|Warn_Pending)
echo "$Warn_Pending"
;;
Pending|pending)
echo "$Pending"
;;
Consumers|consumers)
echo $Consumers
;;
Enqueued|enqueued)
echo $Enqueued
;;
Dequeued|dequeued)
echo $Dequeued
;;
*)
echo "Usage: $0 Pending|Consumers|Enqueued|Dequeued|Warn_Pending"
esac