Monitor ActiveMQ through JConsole/ How to connect AtiveMQ through JConsole

Monitor ActiveMQ through JConsole/ How to connect AtiveMQ through JConsole


Issue

Monitor ActiveMQ through JConsole/ How to connect AtiveMQ through JConsole?

Resolution

Step 1:

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

You can enable/disable JMX support as follows…

Setting the broker property use JMX to true (enabled by default) in activemq.xml file which is located in-:..\\ActiveMQ home directory\conf.

i.e. For xbean configuration


<broker use JMX="true" brokerName="BROKER1"

---
</broker>

Step 2: 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.


<broker xmlns="http://activemq.org/config/1.0" brokerName="localhost"useJmx="true">

...

<managementContext>

<managementContext createConnector="false"/>

</managementContext>

...

</broker>


After above changes activemq.xml file looks like:



Step 3:  Create access and password files

conf/jmx.access:


# The "monitorRole" role has readonly access.

# The "controlRole" role has readwrite access.

monitorRole readonly

controlRole readwrite


jms.access file looks like:



conf/jmx.password:

# The "monitorRole" role has password "abc123".

# The "controlRole" role has password "abcd1234".

monitorRole abc123

controlRole abcd1234


Jmx.password file looks like:



Note:
-Password will get encrypted automatically once you start the service. Initially you have to type in plain text.
-Make sure both files are not world readable - protect the files


Step 4:  Modify the Wrapper.conf in ..\ActiveMQ _home\bin\win64 to enable the Java 1.5+ JMX connector- for ActiveMQ is installed as service

# Uncomment to enable remote Jmx

wrapper.java.additional.13=-Dcom.sun.management.jmxremote.port=1616

wrapper.java.additional.14=-Dcom.sun.management.jmxremote.authenticate=true

wrapper.java.additional.15=-Dcom.sun.management.jmxremote.ssl=false

wrapper.java.additional.16=-Dcom.sun.management.jmxremote.password.file="%ACTIVEMQ_BASE%/conf/jmx.password"

wrapper.java.additional.17=-Dcom.sun.management.jmxremote.access.file="%ACTIVEMQ_BASE%/conf/jmx.access"

After changes file looks like:


                                                                                                OR
Modify the “activemq” startup script (in bin) to enable the Java 1.5+ JMX connector -for activemq start with activemq bat file.
Find the “ACTIVEMQ_SUNJMX_START=” line and change it too the following: (note that in previous versions of ActiveMQ this property was called SUNJMX in some scripts.  As of v5.12.0 all scripts use ACTIVEMQ_SUNJMX_START):

1.Windows

           ACTIVEMQ_SUNJMX_START=-Dcom.sun.management.jmxremote.port=1616 -Dcom.sun.management.jmxremote.ssl=false \
         -Dcom.sun.management.jmxremote.password.file=%ACTIVEMQ_BASE%/conf/jmx.password \
         -Dcom.sun.management.jmxremote.access.file=%ACTIVEMQ_BASE%/conf/jmx.access

2.Unix

           ACTIVEMQ_SUNJMX_START=-Dcom.sun.management.jmxremote.port=1616 -Dcom.sun.management.jmxremote.ssl=false \
         -Dcom.sun.management.jmxremote.password.file=%ACTIVEMQ_BASE%/conf/jmx.password \
         -Dcom.sun.management.jmxremote.access.file=%ACTIVEMQ_BASE%/conf/jmx.access
         Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_BASE}/conf/jmx.password \
         -Dcom.sun.management.jmxremote.access.file=${ACTIVEMQ_BASE}/conf/jmx.access"


Step 5:   Start ActiveMQ

Step 6:  You should be able to connect to JMX on the JMX URL

service:jmx:rmi:///jndi/rmi://<your hostname>:1616/jmxrmi


Open JConsole and enter the URL, Username and Password:




      Links to better reach 

            Bot Store

             EPD