Skip to content


Folders and files

Last commit message
Last commit date

Latest commit



88 Commits

Repository files navigation


Monittr provides a Ruby interface for the Monit systems management system. Its main goal is to aggregate statistics from multiple Monit instances and display them in an attractive web interface.

Monittr loads XML from the web server embedded in Monit and makes it accessible as Ruby objects. It also provides helpers for Sinatra applications, to display the information as HTML. You can insert the statistics into any page, or create a dedicated one. You can use the default template, or create your own. The default template is located in lib/monittr/sinatra/template.erb and pictured below.

Screenshot: Monittr, a web interface for Monit statistics


First, clone or download the sources from Github, to get the latest version:

$ git clone
$ cd monittr

You can try the Ruby interface in a IRB console:

$ irb -Ilib -rubygems -rmonittr

You have to pass one or more URLs to a local or remote Monit HTTP server:

cluster = ['http://localhost:2812/']

In case you don't have a running Monit server at hand, use the provided FakeWeb setup:

require 'fakeweb'
FakeWeb.register_uri(:get, 'http://localhost:2812/_status?format=xml', :body =>'test/fixtures/status.xml') ); nil

cluster = ['http://localhost:2812/']

Now, you can display the information from the cluster:


server = cluster.servers.first


You can also check out the HTML display by running the example application:

$ ruby examples/application.rb
$ open http://localhost:4567/

You should see the information about two faked Monit instances in your browser. (You may need to comment out the FakeWeb section, if you're passing localhost URLs.)

To use the gem in a Sinatra application, you have to require the gem, the Sinatra helper and provide the URLs to Monit instances:

require 'monittr'
require 'monittr/sinatra/monittr'
set :monit_urls,  %w[ ]

In a “modular” Sinatra application, you have to register the module explicitely as well:

register Sinatra::MonittrHTML

Then, just call the helper in your template:

<%= monittr.html %>

You may use the example application as the starting point.


It's easy to customize the HTML output by setting the appropriate options in your Sinatra application.

set :template, { File.join(root, 'template.erb') }
set :stylesheet, '/path/to/my/stylesheet'


The best way to install the gem is from the source:

$ git clone
$ cd monittr
$ rake install

Stable versions of the gem can be installed from Rubygems:

$ gem install monittr


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

Check out the monit gem for another Ruby interface to Monit.

Karel Minarik