How to Manage ActiveMQ with Hawtio on Ubuntu 18.04 | 16.04

This brief tutorial shows students and new users how to manage and monitor Apache ActiveMQ with Hawtio on Ubuntu 18.04 | 16.04.

Apache ActiveMQ is a free, multi-protocol, Java-based message broker software written in Java. You can use its default portal to manage basic configurations.

However if you need a robust management and monitoring platform to manage ActiveMQ, then Hawtio is a great tool to have.

Hawtio is a modular web console tool for managing Java applications. Hawtio has lots of built-in plugins that support Java applications such as, JMX, JVM, OSGi, Apache ActiveMQ, Apache Camel, and more.

This tool comes with a slick web console built with Bootstrap and PatternFly, a UI framework for enterprise web applications.

For more about Hawtio, please check its homepage.

For installing Hawtio on Ubuntu to manage ActiveMQ, please follow the steps below:

Step 1: Install ActiveMQ on Ubuntu

If you’re going to be managing ActiveMQ via Hawtio, then you’ll need ActiveMQ installed and configured on Ubuntu.

We’ve written a great tutorial on how to install ActiveMQ on Ubuntu. To install, read the blog post below:

How to install ActiveMQ on Ubuntu

After reading the post above, continue below to configuring Hawtio to manage ActiveMQ.

Step 2: Install Hawtio to Manage ActiveMQ

At this point you should have a working ActiveMQ application installed on Ubuntu. Now, to manage it via Hawtio, run the commands below to download and configure Hawtio.

To download the latest version of Hawtio, check its releases page at Github.

To the time of this writing, the latest version is at 2.9.1

Use the commands below to download

cd /tmp
sudo wget https://repo1.maven.org/maven2/io/hawt/hawtio-default/2.9.1/hawtio-default-2.9.1.war

Next, run the commands below to extract the downloaded package to ActiveMQ directory, and update the folder permissions to that ActiveMQ user has access to it.

unzip hawtio-default-2.9.1.war -d hawtio
sudo mv hawtio /opt/activemq/webapps/
sudo chown -R activemq:activemq /opt/activemq/webapps/

When you’re done, open Hawtio configuration file and make the highlighted changes below:

sudo nano /opt/activemq/bin/env

Replace the lines below:

ACTIVEMQ_TMP="$ACTIVEMQ_BASE/tmp"
Set jvm memory configuration (minimal/maximum amount of memory)
ACTIVEMQ_OPTS_MEMORY="-Xms64M -Xmx1G"
if [ -z "$ACTIVEMQ_OPTS" ] ; then
ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=$ACTIVEMQ_CONF/login.config"
fi
if [ -z "$ACTIVEMQ_OUT" ]; then
ACTIVEMQ_OUT="/dev/null"
fi
Uncomment to enable audit logging
ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS -Dorg.apache.activemq.audit=true"

With the lines below:

ACTIVEMQ_TMP="$ACTIVEMQ_BASE/tmp"
Set jvm memory configuration (minimal/maximum amount of memory)
ACTIVEMQ_OPTS_MEMORY="-Xms64M -Xmx1G"
if [ -z "$ACTIVEMQ_OPTS" ] ; then
ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=$ACTIVEMQ_CONF/login.config -Dhawtio.realm=activemq -Dhawtio.role=admins -Dhawtio.rolePrincipalClasses=org.apache.activemq.jaas.GroupPrincipal"
fi
if [ -z "$ACTIVEMQ_OUT" ]; then
ACTIVEMQ_OUT="/dev/null"
fi
Uncomment to enable audit logging
ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS -Dorg.apache.activemq.audit=true"

Save the file and exit.

Next, run the commands below to open the configuration file below:

sudo nano /opt/activemq/conf/jetty.xml

Then add the lines just below the <ref bean=”rewriteHandler”> line in the file.

After the setup, the file should look like this:

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

Save the file and exit.

Next, restart ActiveMQ

sudo systemctl restart activemq

After that, login to Hawtio portal.

http://localhost:8161/hawtio

Hawtio Ubuntu Install

Login with Username:Password admin:admin

That should do it.

Conclusion:

This post showed you how to install Hawtio to manage and monitor Apache ActiveMQ. If you find any error above, please use the comment form below to report.

You may also like the post below:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.