ActiveMQ Notes: Administration and Monitoring

ActiveMQ provides a wealth of monitoring and management tools. In ActiveMQ's webpage ( http://activemq.apache.org/how-can-i-monitor-activemq.html ), there are many monitoring and management tools that come with ActiveMQ and third-party.

This article mainly introduces the management tool webconsole that comes with ActiveMQ, the open source management tool http://hawt.io/ based on Jolokia , and the use of ActiveMQ's Advisory messages to programmatically monitor the status of ActiveMQ.

WebConsole

To use WebConsole, you need to add jetty.xml to the ActiveMQ configuration file.

<import resource="file:${activemq.conf}/jetty.xml"/>

 

Jetty.xml configures the Jetty web server used in ActiveMQ. Through this configuration file, the built-in Jolokia-based REST API of WebConsole and ActiveMQ is enabled.

 

In addition, you also need to modify the login name and password in jetty-realm.properties.

 

After completing the configuration, you can access WebConsole through http://${Host}:8161/admin/. Through WebConsole, you can know some main information of ActiveMQ, such as Queues, Topics, etc. Detailed functions can be found at: http://activemq.apache.org/web-console.html .

Hawt.io

ActiveMQ provides rich JMX-based management functions. Using JMX management tools such as jconsole can manage ActiveMQ through the JMX interface. However, if JMX is used remotely, more configuration work is required.

 

The open source Jolokia project provides the ability to access JMX management functions through a REST API. ActiveMQ has integrated the Jolokia class library. Through the same configuration of WebConsole, Jolokia-based REST API can be enabled to access ActiveMQ.

 

Hawt.io is an open source third-party management tool using Jolokia. The tool can be executed as a separate jar file or deployed as a war file to a Servlet Container such as Tomcat/Jetty. The tool can be downloaded via http://hawt.io/ .

 

With Hawt.io, you can provide richer management functions than WebConsole. Using Hawt.io requires some configuration work.

l When establishing a connection between Hawt.io and ActiveMQ, the port is 8161 and the path is api/jolokia. (These are the default configurations of ActiveMQ and can be modified in ActiveMQ's jetty.xml)

l If Hawt.io and ActiveMQ are not on the same machine, you need to set the JVM system property hawtio.proxyWhitelist to start Hawt.io. If you run Hawt.io as a jar file, you can set it on the startup command line, such as:

java -Dhawtio.proxyWhitelist=${Host},127.0.0.1,localhost -jar hawtio-app-1.5.7.jar

 

Advisory message

ActiveMQ provides some management Topics, and through Advisory messages, you can send messages to these Topics to report the internal status of ActiveMQ, such as the establishment of Client Connection, the establishment of Queue, and the establishment of Topics. ActiveMQ's webpage (http://activemq.apache.org/advisory-message.html) provides detailed information about Advisory messages, including Topics name, Default enabled status, and PolicyEntry configuration name.

 

ActiveMQ supports Client using wildcasts to receive messages from multiple Channels. So you can write your own program to monitor "ActiveMQ.Advisory.>." to get all Advisory management messages.

 

In order to use Advisory's messages, some configuration needs to be done. To enable PolicyEntry, you need to partially enable the following entries according to management needs.

<broker advisorySupport="true">

<destinationPolicy>

       <policyMap>

              <policyEntries>

                     <policyEntry topic=">" advisoryForConsumed="true"/>

                     <policyEntry topic=">" advisoryWhenFull="true"/>

                     <policyEntry topic=">" advisoryForDelivery="true"/>

                     <policyEntry topic=">" advisoryForDiscardingMessages="true"/>

                     <policyEntry topic=">" sendAdvisoryIfNoConsumers="true"/>

                   <policyEntry topic=">" advisoryForSlowConsumers="true"/>

                   <policyEntry topic=">" advisdoryForFastProducers="true"/>             

     </policyEntries>

       </policyMap>

</destinationPolicy>

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324663576&siteId=291194637