What is this Hawtio anyway?
Whenever a cool open source project is brought to my attention, I usually subscribe to the mailing lists so that I can get a better feel of the projects progress, direction etc. Sooner or later there is always an email with the topic ” [Discuss] – Webconsole for our cool project“.
Such emails quite often end up in a long discussion about what’s the best web framework to use, what should be the target platform and how the console could be integrated with upstream/downstream projects.
The number of consoles grows so big, that users have to hire a personal assistance just to keep track of the URLs of each web console. Well, maybe that’s an overstatement but you get the idea. And if we also take into consideration that some projects are bound to a specific runtime, while others are not then we have a perfect webconsole storm.
Hawtio solves this problem, by providing a lightweight HTML5 modular web console with tons of plugins. Hawtio can run everywhere as its not bound to a specific runtime, and its modular, which means that its pretty easy to write and hook your own plugins.
Writing plugins for Hawtio
Hawtio is a full client framework. Whenever it requires communication with the backend it can use rest. To make things easier it also use Jolokia that exposes JMX with JSON over HTTP. This makes it pretty easy to hook frameworks even if they don’t already provide a rest interface, but expose things over JMX.
The Jclouds plugin
Apache Jclouds doesn’t have yet a rest interface, nor it has JMX support. Well actually it has pluggable JMX support as of 1.6.1-incubating release. All you need to do is to create a Apache Jclouds Context using the ManagementLifecycle module:
ContextBuilder builder = ContextBuilder.newBuilder(providerOrApi). .credentials(identity, credential) .modules(ImmutableSet.<Module>of(new ManagementLifecycle(BaseManagementContext.INSTANCE))) .build();
Note: Users that are using the jclouds-karaf project, will get that for free (no need to do anything at all).
From there the user is able to browse all installed Apache Jclouds providers, apis and services. If for example, you have created a compute service context with the MangementLifecycle module, you’ll be able to see in it under the ” Compute Service” tab:
By selecting one of the available services, a details bar appears, which helps you navigate to all service specific tabs. For a compute service its:
A detailed list of all running nodes, with the ability to reboot, destroy, suspend & resume a node.
A list of images, with an operating system filter.
A list of all assignable locations
The plugin is not compute service specific. It also supports blobstores. For example, here a view of one of my S3 buckets:
Mix & match
“A couple of years ago I created an example of using Jclouds with Apache Camel to automatically send email notifications about running instances in the cloud.”
Hawtio also provides an Apache Camel plugin, so we can visually see, edit or modify the example that sends the notifications. The great thing is that in this example we are using a Hawtio managed compute service:
The original example can be found at Cloud Notification with Apache Camel.
An other cool plugin that can be used along with the jclouds plugin is the “Logs plugin”, The log plugin let’s you search, browse and filter your logs and even see the source that is associated with the log entries:
This is only a first draft of the jclouds plugin and there are more cool things to be added, like executing scripts, downloading blobs and also have a better way of creating new services (the last is already supported but could be really improved).