15.2. Configuring JMX
Abstract
By default, brokers have JMX activated. However, a broker's JMX behavior is highly configurable. You can specify if JMX is used, if the broker uses a dedicated JMX connector, if the broker creates its own MBean server, and the JMX URL it uses.
Overview
By default a broker is set up to allow for JMX management. It uses the JVM's MBean server and creates its own JMX connector at service:jmx:rmi:///jndi/rmi://hostname:1099/karaf-containerName. If the default configuration does not meet the needs of the deployment environment, the broker provides configuration properties for customizing most aspects of its JMX behavior. For instance, you can completely disable JMX for a broker. You can also force the broker to create its own MBean server.
Enabling and disabling
By default JMX is enabled for a Red Hat JBoss A-MQ broker. To disable JMX entirely you simply set the
broker
element's useJmx
attribute to false
. This will stop the broker from exposing itself via JMX.
Important
Disabling JMX will also disable the commands in the activemq shell.
Securing access to JMX
In a production environment it is advisable to secure the access to your brokers' management interfaces. To set up authentication To override the default role for JMX access add a
jmxRole
property to the etc/org.apache.karaf.management.cfg
file.
Advanced configuration
If the default JMX behavior is not appropriate for your deployment environment, you can customize how the broker exposes its MBeans. To customize a broker's JMX configuration, you add a
managementContext
child element to the broker's broker
element. The managementContext
element uses a managementContext
child to configure the broker. The attributes of the inner managementContext
element specify the broker's JMX configuration.
Table 15.1, “Broker JMX Configuration Properties” describes the configuration properties for controlling a broker's JMX behavior.
Property | Default Value | Description |
---|---|---|
useMBeanServer | true | Specifies whether the broker will use the MBean server created by the JVM. When set to false , the broker will create an MBean server. |
jmxDomainName | org.apache.activemq | Specifies the JMX domain used by the broker's MBeans. |
createMBeanServer | true | Specifies whether the broker creates an MBean server if none is found. |
createConnector | true [a] | Specifies whether the broker creates a JMX connector for the MBean server. If this is set to false the broker will only be accessible using the JMX connector created by the JVM. |
connectorPort | 1099 | Specifies the port number used by the JMX connector created by the broker. |
connectorHost | localhost | Specifies the host used by the JMX connector and the RMI server. |
rmiServerPort | 0 | Specifies the RMI server port. This setting is useful if port usage needs to be restricted behind a firewall. |
connectorPath | /jmxrmi | Specifies the path under which the JMX connector will be registered. |
suppressMBean
| empty |
Specifies a comma-separated list of MBean name patterns to ignore. For example:
endpoint=dynamicProducer,endpoint=Consumer,connectionName=*,destinationName=ActiveMQ.Advisory.*
|
[a]
The default configuration template for the broker sets this property to false so that the broker uses the container's JMX connection.
|
Example 15.1, “Configuring a Broker's JMX Connection” shows configuration for a broker that will only use the JVM's MBean server and will not create its own JMX connector.
Example 15.1. Configuring a Broker's JMX Connection
<broker ... > ... <managementContext> <managementContext createMBeanServer="false" createConnector="false" /> </managementContext> ... </broker>