November 28th, 2010

Monittr: A Ruby and Web Interface for Multiple Monit Instances

Screenshot: Monittr, a Ruby and Web Interface for Monit

On my current contract, we have Monit set up to monitor a number of servers. Obviously, when you monitor something, you’d like to check its status from time to time. And while the default Monit web interface is good enough for a quick check of one system, it has several major shortcomings.

You have to remember or bookmark the URL and credentials for the interface. The interface is “good enough”, but the constant refreshing is kinda crazy.

Worse, you can check only one Monit instance at a time. It’s impossible to do on a regular basis for more than one machine. Of course, there’s MMonit, but it brings another piece to the infrastructure, advanced features which are useless to us, and doesn’t display the system’s status in a concise way. We need something else, altogether.

We need to display some Monit statistics from multiple servers inside our admin application. So, when I’ve discovered that Monit has an XML output (while reading the sources of the monit gem), I knew it would be just a matter of parsing and displaying it.

The result is the monittr Rubygem.

It’s main goal is to be able to plug Monit status information from multiple systems into any Ruby application, specifically into a Sinatra web application.

You can either use the Ruby interface to retrieve the Monit statistics and display them as you wish, or use the provided Sinatra extension to embed them directly into your admin application, like this:

<p>This is your regular admin application...</p>
<div id="monittr">
<%= monittr.html %>
</div>

The project README provides extensive information about how to try out, use and customize it: https://github.com/karmi/monittr. You can customize the template and supply it as your own, changing the content, stylesheets, etc. It’s just an ERB file.

Any feedback, suggestions or patches are welcome via e-mail or Github Issues/Pull Requests.

blog comments powered by Disqus