Christian Posta — Software Blog

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

HawtIO + ActiveMQ

Have you had a chance to take a look at HawtIO yet? If you haven’t, it’s a new web-based dashboard for managing and monitoring JVM-based services like Apache ActiveMQ, Apache Camel, JBoss, Infinispan, Apache Tomcat and many others!. Actually, it’s not just for monitoring, but you can edit, debug, profile your Camel routes and use it as the backbone of a cloud-based integration platform (iPaaS) as James Strachan demos in this video: Introducing the Apache Camel based open source iPaaS. Needless to say, it’s hawt :)

With that hawtness as a backdrop, let’s focus on using HawtIO specifically with ActiveMQ.

I have blogged in the past about plugging HawtIO into a stand-alone version of ActiveMQ — and if you’re interested in collocating your management console with the embedded jetty that comes with ActiveMQ, that’s cool and you should check it out. However, in this blog, we’re going to cover a couple additional things:

  • HawtIO with ActiveMQ 5.9
  • Connecting to a remote ActiveMQ (older than 5.9.0)
  • Connecting to a JVM on your local machine with HawtIO

Next Apache ActiveMQ Release

ActiveMQ 5.9.0 is (hopefully) going to be released some time this Fall 2013. I guess since it’s an open source project, it depends on when we have time to work on it :) But among the many cool new features that I plan to talk about at the Phoenix JUG in September, one of the sexiest is replacing the existing ActiveMQ webconsole with HawtIO! That’s right… the older, dated, webconsole (below) is getting ousted!

So why don’t we get our hands wet a little, and play with a nightly build. You can take a look and get the latest 5.9-SNAPSHOT release. Unpack it and startup ActiveMQ:

$ACTIVEMQ_HOME/bin/activemq console

With the default config that’s loaded, you should be able to navigate to http://localhost:8161/admin to see the old admin console (if it asks for a password, ‘admin’ ‘admin’ is the default username and password):

Old webconsole

BTW! The pics are small, I know. Click on any of them to see full sized!

If you’ve used this web console in the past, you’ll know that it gives you an overview of the broker in terms of destinations, some basic stats, connections, and some limited visibility into network connections. You can also create queues and topics:

Create queue

But now, if you navigate over to http://localhost:8161/hawtio, you should see the hawtio dashboard:

HawtIO Dashboard

On first notice, you’ll see that HawtIO is much more that just an ActiveMQ dashboard. It has plugins for all kinds of technology, and it can all be managed from one place.

At the very top of the UI, you’ll see a tab for “ActiveMQ”. Tabs that appear here are those that have been auto-discovered. This makes sense since this deployment of HawtIO is bundled with ActiveMQ. If you click on the tab, you’ll see a little more detail about the broker:

ActiveMQ Dash

To the left of the main screen is a tree containing the JMX mbeans associated with this broker. This is pretty powerful in my opinion: there was no such MBean browser in the old console. The MBeans are your window into what the broker is doing by giving you stats about destinations, subscriptions, and overall broker health, resource usage, config details, etc.

There are also some visual indications of the broker’s health (Green == good! …memory, store limits, enqueue/dequeues):

ActiveMQ Charts

You also have access to “operations” that are usually tucked away under specific MBeans, but HawtIO brings the most-used ones to the forefront:

ActiveMQ Operations

And in the future, there will be diagrams about broker clusters and topologies and maybe live statistic updates in the diagrams with health overviews. Pretty cool stuff!

Connect Remotely!

HawtIO is really just a webapp deployed into a servlet container as a WAR. So you can deploy into Tomcat, JBoss, or any servlet container you like. What happens if you want to do that, but connect to externally deployed ActiveMQ instances? Well, you’re in luck.

You’ll notice that there is a “Connect” tab on the top panel of the HawtIO screen. Upon clicking it, you can enter in host/port/path information and connect up. HawtIO is expecting to connect up to a jolokia agent, so you’ll need to make sure the service to which you’re connecting supports Jolokia access. In the case of ActiveMQ 5.9, jolokia is exposed by default here: http://localhost:8161/hawtio/jolokia

Fill out your form like this:

HawtIO connect remote ActiveMQ 5.9

Upon clicking “Connect To Remote Server”, you should be connected and presented with a new browser tab/window (note, in some versions of HawtIO you might be presented with a authentication dialog), and this new browser window will now have the ActiveMQ tab and access to the remote ActiveMQ:

HawtIO connect remote ActiveMQ 5.9

What about older versions of ActiveMQ?

So this is all good and well if you’re using ActiveMQ 5.9 which has Jolokia configured for use right out of the box, but what if you’re using the previous version of ActiveMQ (5.8.0, or 5.7.0)?

Well, in fact Jolokia was included in the 5.8.0 version. But for 5.7.0 it wasn’t. The point really should be that there are a couple ways for a JVM to expose a Jolokia access point, and as long as the Jolokia agent is available, HawtIO should be able to connect. So for example, in ActiveMQ 5.9.0 and 5.8.0, it comes with Jolokia and is exposed using a web agent. However, if you disable the embedded jetty in conf/activemq.xml then your best bet would be to expose a JVM agent. This is possible to do for 5.7, 5.8, or 5.9.

I recommend the following approach for adding in the Jolokia JVM agent

  1. Grab a distro of ActiveMQ (5.7.0, 5.8.0, or 5.9.0)
For this exercise, we’re assuming the web-based agent is turned off if it comes installed by default.
  1. Use the create command to create a broker: From your $ACTIVEMQ_HOME dir, run
$ACTIVEMQ_HOME/bin/activemq create ../brokers/hawtio-broker

This will create a broker named “hawtio-broker” in the directory one level up under “brokers”

  1. Navigate to ../brokers/hwatio-broker and edit the bin/hawtio-broker script to include:
export ACTIVEMQ_OPTS=”-javaagent:/path/to/jvmagent/hawtio-broker/lib/jolokia-jvm-1.1.3-agent.jar=port=8160,host=localhost”

This line can go below the other exports that might be in there. Note that the host and port here are what we will set in the HawtIO Connect form when we try to connect remotely.

Example of the script

  1. Next, you need to download the JVM agent from the Jolokia website and place that jar under your ../brokers/hawtio-broker/lib folder. lib won’t be there by default, so create it. ActiveMQ will use this directory as an extension location and load up the agent from there based on the JVM args we set earlier.
  2. Follow the same steps as if you were to connect to a remote ActiveMQ, using the host and port specified in the JVM args above:

You should be greeted with a similar screen to before, with the “ActiveMQ” tab at the top:

We connected to ActiveMQ 5.7.0

Upon clicking the ActiveMQ tab, you should see the stats that verify we are connected to a 5.7.0 (or whatever version you’re using) broker:

We connected to ActiveMQ 5.7.0

There you have it. You can now connect remotely to ActiveMQ brokers with confidence.

Connect Locally

So this last section is still in progress… I will update it as I have time :)

I encourage you to try out HawtIO to monitor your ActiveMQ brokers. Your feedback is also highly valued, and can be directed to the HawtIO community. HawtIO is far more than just an ActiveMQ monitor, however, so check out its other features and stay cool!

11 Responses to “HawtIO + ActiveMQ”

  • Paul Gale says:

    With Hawt.IO is it possible to connect to multiple remote brokers from within in the same browser tab or must each connected broker appear in its own tab?

    Ideally I would like to have one tab acting as a central dashboard in which I can see all brokers side by side.

  • admin says:

    Sounds like you may want to use Fuse Fabric which achieves exactly that:

    http://fuse.fusesource.org/fabric/

    HawtIO is the dashboard for Fuse Fabric also.

  • This demo shows how you can use hawtio as a central dashboard for viewing all of your processes/servers/brokers/camel routes etc:

    https://vimeo.com/68442425

  • George says:

    How can we enabled this for the embedded broker, using maven? Something similar to https://code.google.com/p/jminix/

  • admin says:

    Yep, so hawtio is just a web app.. so as long as you deploy it within the same JVM as your embedded broker, it should find it. If not, you can instrument the jvm with jolokia agents (web or java agent), and you should be able to connect in remotely. So in effect, jolokia plays the similar role that jminix would play and hawtio connects up to that. Simple :)

  • I can't seem to connect locally, there is no Connect (local) tab? I a says:

    Any idea why I can’t connect locally, there is no Connect (local) tab?
    Using standalone jar

  • Mark says:

    Firefox didn’t seem to work for me. Chrome did.

  • Ravi says:

    You described the steps for using HawtIO with older versions of ActiveMQ i.e. with 5.7,5.8
    But will the above steps work for version 5.5 also?

    • admin says:

      I haven’t tried it. I don’t think it will work because the structure of the JMX means changed a little bit. But i would at least give it a try. Enable Jolokia on the old activemq instance and try it. Let me know how it fares of what issues you run into.

  • Bill says:

    Great post…….have a larger question: We have Fuse ESB and AMQ 6.0 deployed on RHEL 6.x and are looking at enabling Production monitoring capability across these environments…..including a separate pure Tomcat deployment. We are aware of the Redhat JON product but the new Hawt.io enabled Fuse Mgmt Console in 6.1 looks impressive. We will plan on upgrading to Fuse 6.1 as part of our next major release but really need a tactical and long term solution to monitoring these environments. Would Hawt.io initially and the next Hawt.io enabled Fuse Mgmt Console 6.1 be a good solution and approach? thoughts


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>