JMX

Apache ActiveMQ has extensive support for JMX to allow you to monitor and control the behavior of the broker via the JMX MBeans.

AMQ Version  >= 5.8.0

The MBean naming documented here applies to the 5.8.0 and later versions of ActiveMQ. Earlier versions of ActiveMQ used a variation of the naming; most, if not all, of the objects, attributes, and operations exist in those earlier versions, but the naming has changed.

Using JMX to monitor Apache ActiveMQ

You can enable/disable JMX support as follows...

1. Run a broker setting the broker property useJmx to true (enabled by default) i.e.

For xbean configuration

2. Run a JMX console

3. Connect to the given JMX URL:

The ActiveMQ broker should appear in the list of local connections, if you are running JConsole on the same host as ActiveMQ.

To connect to a remote ActiveMQ instance, or if the local process does not show up, use Remote Process option, and enter an URL. Here is an example localhost URL:

Using the Apache ActiveMQ version on OS X it appears as follows:


 

ActiveMQ MBeans Reference

For additional references provided below is a brief hierarchy of the mbeans and a listing of the properties, attributes, and operations of each mbeans.

 Mbean Type

Properties / ObjectName 

Attributes 

Operations 

 Broker

  • type=Broker
  • brokerName=<broker identifier>
  • BrokerId
  • TotalEnqueueCount
  • TotalDequeueCount
  • TotalConsumerCount
  • TotalMessageCount
  • TotalConnectionsCount
  • TotalConsumerCount
  • TotalProducerCount
  • MemoryLimit
  • MemoryPercentUsage
  • StoreLimit
  • StorePercentUsage
  • start
  • stop
  • terminateJVM
  • resetStatistics
  • gc

 Destination

  • type=Broker
  • brokerName=<name of broker>
  • destinationType=Queue|Topic
  • destinationName=<name>
  • AverageEnqueueTime
  • ConsumerCount
  • DequeueCount
  • EnqueueCount
  • ExpiredCount
  • InFlightCount
  • MemoryLimit
  • MemoryPercentUsage
  • Name
  • QueueSize (queues only)
  • browseMessages
  • gc
  • purge
  • resetStatistics

 NetworkConnector

  • type=Broker
  • brokerName=<name of broker>
  • connector=networkConnectors
  • networkConnectorName=<connector identifier>
  • Name
  • Duplex
  • DynamicOnly
  • BridgeTempDestinations
  • ConduitSubscriptions
  • DecreaseNetworkConsumerPriority
  • DispatchAsync
  • DynamicOnly
  • NetworkTTL
  • Password
  • PrefetchSize
  • start
  • stop

 Connector

  • type=Broker
  • brokerName=<name of broker>
  • connector=clientConnectors
  • ConnectorName=<connector identifier>
  • StatisticsEnabled
  • start
  • stop
  • resetStatistics
  • enableStatistics
  • disableStatistics
  • connectionCount

 Connection

  • type=Broker
  • brokerName=<name of broker>
  • connectionViewType=clientId
  • connectionName=<connection identifier>
  • DispatchQueueSize
  • Active
  • Blocked
  • Connected
  • Slow
  • Consumers
  • Producers
  • RemoteAddress
  • UserName
  • ClientId
  • start
  • stop
  • resetStatistics

  PersistenceAdapter

  • type=Broker
  • brokerName=<broker name>
  • Service=PersistenceAdapter
  • InstanceName=<adapter identifier>
  • Name
  • Size
  • Data
  • Transactions

 

 Health

  • type=Broker
  • brokerName=<broker name>
  • Service=Health
  • CurrentStatus
  • health

Command line utilities are also available to let you monitor ActiveMQ. Refer to ActiveMQ Command Line Tools Reference for usage information.

JMX API is also exposed via REST management API

Password Protecting the JMX Connector

(For Java 1.5+)

1. Make sure JMX is enabled, but tell ActiveMQ not create its own connector so that it will use the default JVM JMX connector.

2. Create access and password files

conf/jmx.access:

conf/jmx.password:

(Make sure both files are not world readable - more info can be find here to protect files)

For more details you can see the Monitoring Tomcat Document

3. Modify the "activemq" startup script (in bin) to enable the Java 1.5+ JMX connector

Find the "SUNJMX=" line and change it too:

This could be set in /etc/activemq.conf instead (if you have root access):

4. Start ActiveMQ

You should be able to connect to JMX on the JMX URL

And you will be forced to login.

Advanced JMX Configuration

The activemq.xml configuration file allows you to configure how ActiveMQ is exposed to JMX for management.  In some cases, you may need to tweak some of it's settings such as what port is used.

Example:

In 4.0.1 or later, on Java 1.5 or later we try and use the default platform MBeanServer (so that things like the JVM threads & memory settings are visible).

If you wish to change the Java 5 JMX settings you can use various JMX system properties

For example you can enable remote JMX connections to the Sun JMX connector, via setting the following environment variable (using set or export depending on your platform). These settings only configure the Sun JMX connector within Java 1.5+, not the JMX connector that ActiveMQ creates by default.

(The SUNJMX environment variable is simple used by the "activemq" startup script, as additional startup parameters for java. If you start ActiveMQ directly, you'll have to pass these parameters yourself.)

ManagementContext Properties Reference

Property Name

Default Value

Description

useMBeanServer

true

If true then it avoids creating a new MBean server if a MBeanServer has already been created in the JVM

jmxDomainName

org.apache.activemq

The jmx domain that all objects names will use

createMBeanServer

true

If we should create the MBeanServer is none is found.

createConnector

true

If we should create a JMX connector (to allow remote management) for the MBeanServer

connectorPort

1099

The port that the JMX connector will use

connectorHost

localhost

The host that the JMX connector and RMI server (if rmiServerPort>0) will use

rmiServerPort

0

The RMI server port, handy if port usage needs to be restricted behind a firewall

connectorPath

/jmxrmi

The path that JMX connector will be registered under

findTigerMBeanServer

true

Enables/disables the searching for the Java 5 platform MBeanServer

© 2004-2011 The Apache Software Foundation.
Apache ActiveMQ, ActiveMQ, Apache, the Apache feather logo, and the Apache ActiveMQ project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram