Enabling graphs on your shinken monitor

10/12/2014 Maarten De Paepe How to Luis Llerena

If you've set up a shinken monitor, you'll probably be a bit disappointed that the graph feature is not included, and that setting it up isn't all that easy. Luckily, this guide will show you how to do this, fairly easy.

The first thing to know is that you'll be needing a dedicated graphing service. This service is in no way affiliated to shinken. So basically, it's a standalone service that you plug into shinken. For this guide we'll be using Graphite as this service. This guide also assumes you are using ubuntu, shinken 2.0.3 and are using the shinken webui module.

We won't be discussing how to install graphite, but I can recommend this excellent guide on how to install it using nginx.

Once you have your graphite service up and running, it's time to install the graphite and ui-graphite modules. Be sure to run these command as the shinken user.

$ shinken install graphite
$ shinken install ui-graphite

Once these modules are installed, we have to enable them.

First find your broker configuration. It should be at /etc/shinken/brokers/broker-master.cfg  and add the graphite module to the broker.

define broker {
   ...
   modules  webui,graphite
   ...
}
You're should already having the webui module here, so you can just append the graphite module. After that, we need to enable the ui-graphite module. This is pretty simple as well. Find your webui configuration, it should be at /etc/shinken/modules/webui.cfg, and add the module
define module {
    module_name         webui
    module_type         webui
    ...
    modules auth-cfg-password,SQLitedb,ui-graphite
    ...
}
You probably have some other modules enabled here, so you can just append it again. The next step is to configure the graphite and ui-graphite modules. You can find the configuration files for both at /etc/shinken/modules/ . You can configure ui-graphite to make to look something like this.
define module {
    module_name     ui-graphite
    module_type     graphite-webui
    uri             http://
    templates_path  /var/lib/shinken/share/templates/graphite/
}

Make your graphite configuration look something like this when you want to use raw socket data:

define module {
    module_name     graphite
    module_type     graphite_perfdata
    host            localhost
    port            2003
}

or like this for pickled data:

define module {
    module_name     graphite
    module_type     graphite_perfdata
    host            localhost
    port            2004
    use_pickle      1
}
A final hint is to make sure your locale is set correctly for the graphite service. This can be done at /your/graphite/folder/local_settings.py. You need to set it to the same locale as the server, or else the 4 hour graphs will not work, and the other graphs will give faulty data/time pairs.

Enjoy your graphs!

Maarten De Paepe

Maarten is a software engineer, forever employee #1, he enjoys fiddling with Python and JavaScript.