ActiveMQ uses hawtio for monitoring

   The function of ActiveMQ's own management interface is very simple. It can only view simple information such as ActiveMQ's current Queue and Topics, but cannot monitor ActiveMQ's own running JMX information. HawtIO is a new pluggable HTML5 panel designed to monitor ActiveMQ, Camel, Karaf, Fuse Fabric, Tomcat and other systems. ActiveMQ once embedded hawtio into its own management interface in version 5.9.0, but due to the controversy over the introduction of hawtio, it was removed in version 5.9.1, but developers can use hawtio to monitor ActiveMQ through configuration . This article introduces two configuration methods to use hawtio to monitor ActiveMQ.

  1.  ActiveMQ monitoring using hawtio application

      Download the latest running jar package hawtio-app-1.4.66.jar of the latest version of hawtio from http://hawt.io/getstarted/index.html After downloading, switch to the directory where the jar package is located and execute    

java -jar hawtio-app-1.4.66.jar

     Start the hawtio program, the default program occupies the port number 8080, if the port 8080 is already occupied, please use the port startup parameter to specify the startup port number. For example, we use 8090 as the startup port number to start the hawtio program

java -jar hawtio-app-1.4.66.jarport 8090

When the welcome page of hawtio appears in the browser ( http://[hawtio host ip]:[hawtio startup port number)/hawtio/welcome), it means that the hawtio program is successfully started, and we can use it to connect to the remote ActiveMQ server

In the welcome interface, click the [Connect] menu in the upper menu bar to open the Connect interface. On this page, we can configure and connect to the ActiveMQ server we want to connect to.

We click the blue [+] button on the right to add an ActiveMQ connection, and we fill in the parameters we need for the connection in the text box:

  • Project connection name (used to save the connection)
  • ActiveMQ host ip (or hostname)

  • ActiveMQ port number (that is, the management page port number configured in the jetty.xml file of ActiveMQ)

  • jolokia pathname (for ActiveMQ, use api/jolokia)

After the configuration is complete, you can click the [Save] button to save, and the next time you start hawtio, you can select the saved connection from the drop-down list to connect.

Click [Connect to remote server] to connect to the remote ActiveMQ server. When connecting to the server, you will be asked to enter the connection user name and password (that is, the login user name/password of the ActiveMQ management page). After the input is completed, after the verification is passed, the ActiveMQ server will be connected. success.

Click the [ActiveMQ] menu at the top to view the Queue, Topic, and information contained in the Queue and Topic of the connected ActiveMQ itself, including the Consumer and Producer information of the connected Queue and Topic.

Click the [DashBoard] menu at the top to view the system information of the connected ActiveMQ, including CPU, memory usage information, etc.

Click the [JMX] menu at the top to view the JMX information of ActiveMQ

Click the [Logs] menu at the top, you can view the running log information of ActiveMQ (that is, the activemq.log information in the data directory), and you can simply filter the log information

Click the [Threads] menu at the top to view the thread information inside the ActiveMQ server

When using the hawtio single program, multiple remote ActiveMQ servers can be monitored.

 2. Integrate hawtio into ActiveMQ for monitoring.

Download hawtio-offline-default.war from http://hawt.io/getstarted/index.html page

After downloading, copy it to the webapps directory of the ActiveMQ installation directory, rename it as hawtio.war, and decompress it to the hawtio directory (you can also do not need to decompress it, and the subsequent configuration modifications will be slightly different)

Edit the conf/jetty.xml file in the ActiveMQ installation directory and add the following code on line 75

<bean class="org.eclipse.jetty.webapp.WebAppContext">        
        <property name="contextPath" value="/hawtio" />        
        <property name="war" value="${activemq.home}/webapps/hawtio" />        
        <property name="logUrlOnStart" value="true" />  
</bean>

If the hawtio.war file was not decompressed before, the value of the war attribute should be changed to webapps/hawtio.war

Next, modify different files according to the operating system where ActiveMQ is located. If it is a Linux or Mac system, modify the bin/env script file in the ActiveMQ installation directory as follows:

 if [ -z "$ACTIVEMQ_OPTS" ] ; then
    ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY -Dhawtio.realm=activemq -Dhawtio.role=admins -Dhawtio.rolePrincipalClasses=org.apache.activemq.jaas.GroupPrincipal -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=$ACTIVEMQ_CONF/login.config"
fi

If it is a windows system, modify the bin/activemq.bat file

if "%ACTIVEMQ_OPTS%" == "" set ACTIVEMQ_OPTS=-Xms1G -Xmx1G -Dhawtio.realm=activemq -Dhawtio.role=admins -Dhawtio.rolePrincipalClasses=org.apache.activemq.jaas.GroupPrincipal -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config="%ACTIVEMQ_CONF%\login.config" 

It should be noted that the three settings of -Dhawtio must be placed at the top of the ACTIVEMQ_OPTS setting (after the memory parameter setting), otherwise there will be an error that the verification cannot pass (in addition, the setting statement of ACTIVEMQ_OPTS should not be carriage return and line feed)

After the modification is completed, start ActiveMQ (in Windows environment, please use the command line activemq start to start, do not double-click the activemq.bat file in the win64 directory, otherwise the added hawtio parameter settings in the activemq.bat file will not take effect), we You can see that the hawtio webapp is loaded

Visit http://localhost:8161/hawtio (there will be differences depending on the machine IP of ActiveMQ and the port number of the admin page set in jetty.xml), and enter the hawtio console page.

Enter the admin account and password (the same as the ActiveMQ management page) to enter the hawtio page.

Click the [ActiveMQ] menu to enter the ActiveMQ monitoring page, which is the same as running hawtio to connect to the ActiveMQ server.

The integration of hawtio into ActiveMQ has been verified on both CentOS 7 and Windows 7 64bit systems.

Use ActiveMQ version as ActiveMQ 5.14.1

Guess you like

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