Christian Posta — Software Blog

Become the best you can be at your profession. If you've stopped learning, you've given up.

Plugging the HawtIO monitoring webapp into a stand-alone ActiveMQ instance

HawtIO is a new pluggable HTML5 dashboard for monitoring ActiveMQ, Camel, Karaf, Fuse Fabric, Tomcat, and other technologies. Actually, I was completely surprised to see the list of plugins already available and how HawtIO has already gained so much good traction. Not surprisingly though… it does some pretty cool stuff…

The purpose of this quick post is to help you plug HawtIO into your stand-alone ActiveMQ instances with minimal fuss. For production deployments, I would recommend using a hardened, production-ready version of ActiveMQ such as FuseMQ Enterprise, but some folks stick with the community versions and a standalone deployment. Let’s say you had the latest version of ActiveMQ and wanted to pop HawtIO into it to see how “hawt” it is.

First, HawtIO is a webapp packaged as a normal war file that can be deployed to any servlet container. This means you can deploy it, for example, to a Tomcat instance which has an embedded ActiveMQ along with some Camel routes, and HawtIO would discover and allow you to monitor all three technologies from the same dashboard. But like I said before, this post is more about the stand-alone deployments. The stand-alone ActiveMQ itself doesn’t run in a servlet container, but does contain an embedded Jetty server that it uses for its current web console. Basically, what we want to do is tell the embedded Jetty server to find the HawtIO war and load it up.

Start by downloading the HawtIO war and put it at your $ACTIVEMQ_HOME/hawtio folder (that folder won’t exist out of the box, you’ll have to create it).

Then edit the Jetty config file in $ACTIVEMQ_HOME/conf/jetty.xml

You’ll want to add the following WebAppContext to the handlers property:

<bean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler">
  ...
  <property name="handler">
     <bean id="sec" class="org.eclipse.jetty.server.handler.HandlerCollection">
     <property name="handlers">
       <list>
          ...
         <bean class="org.eclipse.jetty.webapp.WebAppContext">
           <property name="contextPath" value="/hawtio" />
           <property name="war" value="${activemq.home}/hawtio/hawtio-default-1.1.war" />
           <property name="logUrlOnStart" value="true" />
         </bean>

Next, we’ll need to tweak the contents of the hawtio war file because it will contain a conflicting slf4j jar that would normally already be on the classpath for ActiveMQ:

zip -d $ACTIVEMQ_HOME/hawtio/hawtio-web-1.0.war WEB-INF/lib/slf4j-api-1.6.1.jar

After that you should be good to go. Start ActiveMQ and Navigate your browser to http://localhost:8161/hawtio/

Then have fun hacking around!

Updated to use latest release, hawtio 1.1!

No need to do the extra step of modifying the contents of the WAR file. Just point to the WAR file in your jetty.xml config file, and you’re off!

5 Responses to “Plugging the HawtIO monitoring webapp into a stand-alone ActiveMQ instance”

  • Great post! Maybe do a quick edit and use hawtio-default-1.1.war in that post instead; its the new release which has things like the insight-log added too

  • admin says:

    Thanks James! Update made.

  • Preben says:

    Small comment to the good post.
    If you had any previous installations you have to delete the .hawtio folder in your home directory before starting activemq. Seems that there are some stuff left from my 1.0 installation that makes the webapp not responde. After deleting it it works nice.

  • Piyush says:

    I tried integrating hawtio and the page keeps asking for credentials.. what should I do?

  • Anuj says:

    Getting access 403 ./activemq -Dhawtio.authenticationEnabled=false start


Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>