此内容没有您所选择的语言版本。

Chapter 33. 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.

33.1. 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 as 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)
Copy to Clipboard Toggle word wrap

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)
Copy to Clipboard Toggle word wrap

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.

  1. Navigate to Configuration Subsystems Messaging - ActiveMQ Messaging Provider.
  2. Select the provider and select Provider Settings from the drop down.
  3. Click Edit under the Attributes tab.
  4. Check the Statistics enabled checkbox 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 Messaging Provider.
  2. Select the provider and select Connections from the drop down.
  3. Select the Pooled Connection Factory page.
  4. Select the pooled connection factory and click Edit under the Attributes tab.
  5. Check the Statistics enabled checkbox and click Save.
  6. Reload the server for the changes to take effect.

    • For a standalone server, click the Reload Server Now button to reload the server.
    • In a managed domain, click the Go to Runtime button. From the Runtime tab, select the appropriate server and click the Reload drop down option to reload the server.

33.2. 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,
            ...
        }
    }
    Copy to Clipboard Toggle word wrap
  • 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,
            ...
        }
    }
    Copy to Clipboard Toggle word wrap
  • 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,
            ...
        }
    }
    Copy to Clipboard Toggle word wrap
    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 click View. Select the messaging provider and click View.

Select Queues, Topics, or Pooled Connection Factory depending on which type of statistics you are interested in.

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.

33.3. 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)
Copy to Clipboard Toggle word wrap

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)
Copy to Clipboard Toggle word wrap

33.4. 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
Copy to Clipboard Toggle word wrap

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\"}"
}
Copy to Clipboard Toggle word wrap

33.5. 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
}
Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat