Monitoring JMS resources with JBoss AS 7

In this 5 minutes tutorial we will show how to monitor the critical metrics of JMS subsystem of standalone and domain JBoss AS 7 servers.

Well, at first start JBoss AS 7 using a distribution that ships with the messaging subsystem (e.g.): -c standalone-full.xml

The JMS metrics can be both inspected using CLI and the Web admin interface.

Using the CLI

If you want to monitor a JMS destination using the CLI, you can use the read-resource command on the selected destination (for example the testQueue)

    "outcome" = "success",
    "result" = {
        "consumer-count" = 0,
        "dead-letter-address" = "jms.queue.DLQ",
        "delivering-count" = 0,
        "durable" = true,
        "entries" = [
        "expiry-address" = "jms.queue.ExpiryQueue",
        "message-count" = 2L,
        "messages-added" = 2L,
        "paused" = false,
        "queue-address" = "jms.queue.testQueue",
        "scheduled-count" = 0L,
        "selector" = undefined,
        "temporary" = false

And this is a list ofthe key metrics:

message-count:       The number of messages currently in this queue.
delivering-count:     The number of messages that this queue is currently delivering to its consumers.
scheduled-count:     The number of scheduled messages in this queue.
messages-added:     The number of messages added to this queue since it was created.

If you are running in domain mode, you have to specify the host and server before the subsystem:


  Handy Trick: how to read a metric using the Bash shell

If you are running a linux shell (or en emulator for Windows) you can take advantage of non-interactive features of CLI to read a single attribute which can be stored into a shell variable. Create a file named for example metric.cli which contains the connect command and a read-attribute of a metric (e.g. the consumer-count)


Now execute this cli in non-interactive mode, capturing with awk the result:

consumers=$( –-file=metric.cli | awk '$1=="\"result\"" {print $3}')

if you try to echo the consumers variable, it will contain the number of consumers for a JMS Destinations

$ echo "$consumers"


Using the Web admin console

You can use as well the Web admin console which exposes the same metrics by navigating into the Runtime upper tab and selecting the JMS Destinations in the left panel: