Admin tools for ActiveMQ

Check out these pages on the ActiveMQ site http://activemq.apache.org/activemq-command-line-tools-reference.html

One important item to keep track of is the number of messages going through each queue.  This can be done with the activemq-admin tool. One of the most useful options of this tool is query which returns information about each queue.  The general format is:
   activemq-admin query

To get information about a particular queue use the -QQueue=queue_name; * works as a wildcard.

Due to our set up, we also need to set the rmi jmx details (port number, username, and password) via jmx flags: --jmxuser user_name --jmxpassword password_string --jmxurl service:jmx:rmi:///jndi/rmi://localhost:11223/jmxrmi

This script starts collecting stats such as the number of dequeued messages every 120secs into a file with the starting time stamp as part of the file name:

#!/bin/bash
nd=`date +%d.%m.%y-%H.%M.%S`
echo $nd
file_out="/tmp/stats_$nd"
echo $file_out

i=0
while [ $i -lt 30 ]
do
 echo -n "date: " >> $file_out
 date >> $file_out
 ../bin/activemq-admin query -QQueue=my.important.queue --jmxuser user_name --jmxpassword password_string --jmxurl service:jmx:rmi:///jndi/rmi://localhost:11223/jmxrmi >> $file_out
 echo " " >> $file_out
 let i=$i+1
 sleep 120
done

Running activemq-admin against a queue will give a number of useful pieces of information about a queue such as the number of enqueued or dequeued messages.

We used the activemq-admin query command to diagnose a problem with message flow - more on that here.

For a way to find which queues have old messages and to list the number of old messages this post has more.

Comments

Popular Posts