Chapter 36. Monitoring messaging statistics


When statistics collection is enabled for a messaging server in the messaging-activemq subsystem, you can view runtime statistics for resources on the messaging server.

Enabling messaging statistics
Because it can negatively impact performance, statistics collection for the messaging-activemq subsystem is not enabled by default. You do not need to enable queue statistics to obtain basic information, such as the number of messages on a queue or the number of messages added to a queue. Those statistics are available using queue attributes without requiring that you set statistics-enabled to true.

You can enable additional statistics collection using the management CLI or the management console.

Enable messaging statistics using the management CLI
The following management CLI command enables the collection of statistics for the default messaging server.
/subsystem=messaging-activemq/server=default:write-attribute(name=statistics-enabled,value=true)

Pooled connection factory statistics are enabled separately from the other messaging server statistics. Use the following command to enable statistics for a pooled connection factory.

/subsystem=messaging-activemq/server=default/pooled-connection-factory=activemq-ra:write-attribute(name=statistics-enabled,value=true)

Reload the server for the changes to take effect.

Enable messaging statistics using the management console
Use the following steps to enable statistics collection for a messaging server using the management console.

Procedure

  1. Navigate to Configuration Subsystems Messaging (ActiveMQ) Server.
  2. Select the server and click View.
  3. Click Edit under the Statistics tab.
  4. Set the Statistics Enabled field to ON and click Save.

Pooled connection factory statistics are enabled separately from the other messaging server statistics. Use the following steps to enable statistics collection for a pooled connection factory.

  1. Navigate to Configuration Subsystems Messaging (ActiveMQ) Server.
  2. Select the server, select Connections, and click View.
  3. Select the Pooled Connection Factory tab.
  4. Select the pooled connection factory and click Edit under the Attributes tab.
  5. Set the Statistics Enabled field to ON and click Save.
  6. Reload the server for the changes to take effect.
Viewing messaging statistics
You can view runtime statistics for a messaging server using the management CLI or management console.
View Messaging statistics using the management CLI

You can view messaging statistics using the following management CLI commands. Be sure to include the include-runtime=true argument as statistics are runtime information.

  • View statistics for a queue.

    /subsystem=messaging-activemq/server=default/jms-queue=DLQ:read-resource(include-runtime=true)
    {
        "outcome" => "success",
        "result" => {
            "consumer-count" => 0,
            "dead-letter-address" => "jms.queue.DLQ",
            "delivering-count" => 0,
            "durable" => true,
            ...
        }
    }
  • View statistics for a topic.

    /subsystem=messaging-activemq/server=default/jms-topic=testTopic:read-resource(include-runtime=true)
    {
        "outcome" => "success",
        "result" => {
            "delivering-count" => 0,
            "durable-message-count" => 0,
            "durable-subscription-count" => 0,
            ...
        }
    }
  • View statistics for a pooled connection factory.

    /subsystem=messaging-activemq/server=default/pooled-connection-factory=activemq-ra/statistics=pool:read-resource(include-runtime=true)
    {
        "outcome" => "success",
        "result" => {
            "ActiveCount" => 1,
            "AvailableCount" => 20,
            "AverageBlockingTime" => 0L,
            "AverageCreationTime" => 13L,
            "AverageGetTime" => 14L,
            ...
        }
    }
    Note

    Pooled connection factory statistics are enabled separately from the other messaging server statistics. See Enabling Messaging Statistics for instructions.

View messaging statistics using the management console
To view messaging statistics from the management console, navigate to the Messaging (ActiveMQ) subsystem from the Runtime tab, and select the server. Select a destination to view its statistics.
Note

The Prepared Transactions page is where you can view, commit, and roll back prepared transactions. See Managing Messaging Journal Prepared Transactions for more information.

See Messaging Statistics for a detailed list of all available statistics.

Configuring message counters

You can configure the following message counter attributes for a messaging server.

  • message-counter-max-day-history: The number of days the message counter history is kept.
  • message-counter-sample-period: How often, in milliseconds, the queue is sampled.

The management CLI command to configure these options uses the following syntax. Be sure to replace STATISTICS_NAME and STATISTICS_VALUE with the statistic name and value you want to configure.

/subsystem=messaging-activemq/server=default::write-attribute(name=STATISTICS_NAME,value=STATISTICS_VALUE)

For example, use the following commands to set the message-counter-max-day-history to five days and the message-counter-sample-period to two seconds.

/subsystem=messaging-activemq/server=default:write-attribute(name=message-counter-max-day-history,value=5)
/subsystem=messaging-activemq/server=default:write-attribute(name=message-counter-sample-period,value=2000)
Viewing the message counter and history for a queue

You can view the message counter and message counter history for a queue using the following management CLI operations.

  • list-message-counter-as-json
  • list-message-counter-as-html
  • list-message-counter-history-as-json
  • list-message-counter-history-as-html

The management CLI command to use display these values uses the following syntax. Be sure to replace QUEUE_NAME and OPERATION_NAME with the queue name and operation you want to use.

/subsystem=messaging-activemq/server=default/jms-queue=QUEUE_NAME:OPERATION_NAME

For example, use the following command to view the message counter for the TestQueue queue in JSON format.

/subsystem=messaging-activemq/server=default/jms-queue=TestQueue:list-message-counter-as-json
{
    "outcome" => "success",
    "result" => "{\"destinationName\":\"TestQueue\",\"destinationSubscription\":null,\"destinationDurable\":true,\"count\":0,\"countDelta\":0,\"messageCount\":0,\"messageCountDelta\":0,\"lastAddTimestamp\":\"12/31/69 7:00:00 PM\",\"updateTimestamp\":\"2/20/18 2:24:05 PM\"}"
}
Reset the message counter for a queue
You can reset the message counter for a queue using the reset-message-counter management CLI operation.
/subsystem=messaging-activemq/server=default/jms-queue=TestQueue:reset-message-counter
{
    "outcome" => "success",
    "result" => undefined
}
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat Documentation

Legal Notice

Theme

© 2026 Red Hat
Back to top