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

  1. Navigate to ConfigurationSubsystemsMessaging (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 ConfigurationSubsystemsMessaging (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.

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,
            ...
        }
    }
  • 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.

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)

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)

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

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\"}"
}

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
}

33.6. Runtime Operations Using the Management Console

Using the management console you can:

  • Perform forced failover to another messaging server
  • Reset all message counters for a messaging server
  • Reset all message counters history for a messaging server
  • View information related to a messaging server
  • Close connections for a messaging server
  • Roll back transactions
  • Commit transactions

Performing Forced Failover to Another Messaging Server

  1. Access the management console and navigate to Server using either of the following:

    • RuntimeBrowse ByHostsHostServer
    • RuntimeBrowse ByServer GroupsServer GroupServer
  2. Click Messaging ActiveMQServer
  3. Click the arrow button next to View and click Force Failover.
  4. On the Force Failover window, click Yes.

Resetting All Message Counters for a Messaging Server

  1. Access the management console and navigate to Server using either of the following:

    • RuntimeBrowse ByHostsHostServer
    • RuntimeBrowse ByServer GroupsServer GroupServer
  2. Click Messaging ActiveMQServer
  3. Click the arrow button next to View and click Reset.
  4. On the Reset window, click the toggle button next to Reset all message counters to enable the functionality.

    The button now displays ON in a blue background.

  5. Click Reset.

Resetting Message Counters History for a Messaging Server

  1. Access the management console and navigate to Server using either of the following:

    • RuntimeBrowse ByHostsHostServer
    • RuntimeBrowse ByServer GroupsServer GroupServer
  2. Click Messaging ActiveMQServer
  3. Click the arrow button next to View and click Reset.
  4. On the Reset window, click the toggle button next to Reset all message counters history to enable the functionality.

    The button now displays ON in a blue background.

  5. Click Reset.

Viewing Information Related to a Messaging Server

Using the management console you can view a list of the following information related to a messaging server:

  • Connections
  • Consumers
  • Producers
  • Connectors
  • Roles
  • Transactions

To view information related to a messaging server:

  1. Access the management console and navigate to Server using either of the following:

    • RuntimeBrowse ByHostsHostServer
    • RuntimeBrowse ByServer GroupsServer GroupServer
  2. Click Messaging ActiveMQServer and then click View.
  3. Click the appropriate item on the navigation pane to view a list of the item on the right pane.

Closing Connections for a Messaging Server

You can close connections by providing an IP address, an ActiveMQ address match or a user name.

To close connections for a messaging server:

  1. Access the management console and navigate to Server using either of the following:

    • RuntimeBrowse ByHostsHostServer
    • RuntimeBrowse ByServer GroupsServer GroupServer
  2. Click Messaging ActiveMQServer and then click View.
  3. On the navigation pane, click Connections.
  4. On the Close window, click the appropriate tab based on which connection you want to close.
  5. Based on your selection, enter the IP address, ActiveMQ address match, or the user name, and then click Close.

Rolling Back Transactions for a Messaging Server

  1. Access the management console and navigate to Server using either of the following:

    • RuntimeBrowse ByHostsHostServer
    • RuntimeBrowse ByServer GroupsServer GroupServer
  2. Click Messaging ActiveMQServer and then click View.
  3. On the navigation pane, click Transactions.
  4. Select the transaction you want to roll back and click Rollback.

Committing Transactions for a Messaging Server

  1. Access the management console and navigate to Server using either of the following:

    • RuntimeBrowse ByHostsHostServer
    • RuntimeBrowse ByServer GroupsServer GroupServer
  2. Click Messaging ActiveMQServer and then click View.
  3. On the navigation pane, click Transactions.
  4. Select the transaction you want to commit and click Commit.