Platinum Partner
java,enterprise-integration,tips and tricks,html & xhtml,activemq,apache camel,apache karaf,hawtio

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-web-1.0.war" />
                            <property name="logUrlOnStart" value="true" >
                        </bean></p>
 
<p>

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!




Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}