Tutorial

How To Install and Configure Shinken on Ubuntu 12.04 to Monitor a VPS Instance

Published on April 11, 2014
author

Mouad Zahrane

How To Install and Configure Shinken on Ubuntu 12.04 to Monitor a VPS Instance

Status: Deprecated

This article covers a version of Ubuntu that is no longer supported. If you are currently operate a server running Ubuntu 12.04, we highly recommend upgrading or migrating to a supported version of Ubuntu:

Reason: Ubuntu 12.04 reached end of life (EOL) on April 28, 2017 and no longer receives security patches or updates. This guide is no longer maintained.

See Instead: This guide might still be useful as a reference, but may not work on other Ubuntu releases. If available, we strongly recommend using a guide written for the version of Ubuntu you are using. You can use the search functionality at the top of the page to find a more recent version.

Introduction

Shinken is an open source monitoring framework based on Nagios Core which has been rewritten in python to enhance flexibility, scalability, and ease of use. Shinken is fully compatible with Nagios and supports its plugins and configurations that can be used on the go without rewriting or adjusting.

Shinken has no limits regarding distribution. It can be scaled to the lan LAN, through the DMZs and even across several datacenters.

Shinken goes beyond the classical monitoring functions of Nagios, allowing distributed and highly available monitoring of assets, a smart and automatic management of VMware topologies and different hypervisors (Xen,KVM,…), and is able to monitor Amazon EC2 hosted applications (like mysql & Apache) automatically.

Shinken is considered 5 times faster than Nagios, and comes with a large number of monitoring packages that can be easily installed, providing a faster way to start monitoring servers, services, and applications.

In this guide, we will configure two droplets. One will be configured as the server, the other as a client. They both will run Ubuntu 12.04 LTS.

Installing Shinken Server

We will start with the Server using the automated installation script.

curl -L http://install.shinken-monitoring.org | /bin/bash

The install script will create the user and group. Install all dependencies and then process Shinken installation.

Once the installation is done, the shinken WebUI can be accessed using the http://X.X.X.X:7767 and the credentials admin/admin. The configuration folder will be located in /usr/local/shinken/etc.

Preconfiguring Shinken Server

Before diving in the configuration process of Shinken, we need to secure its WebUI.

Let’s edit the module web UI:

nano /usr/local/shinken/etc/shinken-specific.cfg

We’ll start by changing the auth_secret, and replacing CHANGE_ME by strong password:

define module {
 modules Apache_passwd, ActiveDir_UI, Cfg_password, PNP_UI, Mongodb, Glances_UI
 manage_acl 1
 play_sound 0
 host 0.0.0.0
 module_type webui
 allow_html_output 0
 max_output_length 100
 module_name WebUI
 auth_secret CHANGE_ME         
 port 7767
}

Save and close the file.

Then our admin user should get a strong password too. For that we’ll replace his default password by a secret strong one on the contacts.cfg file :

nano /usr/local/shinken/etc/contacts.cfg

define contact{
   use             generic-contact
   contact_name    admin
   email           shinken@localhost
   pager           0600000000   ; contact phone number
   password        admin
   is_admin        1
}

Even if the installer takes care of installing all the necessary dependencies and modules, we need to install mongodb support for handling and saving user preferences on the webui, or we will get an ugly warning message on the web UI saying:

Error : you didn’t define a WebUI module for saving user preference like the Mongodb one. You won’t be able to use this page!

To install Mongodb support:

cd /usr/local/shinken
./install -a mongodb

Configuring Shinken Server

For our scenario, we will start by declaring the Ubuntu 12.04 monitored host (Shinken slave), install and configure SNMP on it, and then monitor it using a custom community string.

The SNMP template will processes the following checks:

  • host check each 5 minutes: check with a ping that the server is UP

  • check disk spaces

  • check load average

  • check the CPU usage

  • check physical memory and swap usage

  • check network interface activities

Once it’s done, we’ll use FTP and SSH package to check FTP & SSH states on the slave as an example on how to use packages.

Packages are predefined monitoring templates for generic or specific services, appservers, operating systems and monitored-capable devices. These packages are located in the following directory /usr/local/shinken/etc/packs categorized by type, and to use them we only need to specify their names on the host definition file.

Since Shinken is fully compatible and supports Nagios, Nagios plugins can be added and used through Shinken.

Define slave on Shinken

One the monitoring server, let’s create a host file corresponding to our Linux device (Ubuntu slave droplet) on /usr/local/shinken/etc/hosts directory:

nano /usr/local/shinken/etc/hosts/shinken_slave.cfg

Copy and paste the following content and change the “host_name”, and “address” fields to appropriate values.

define host{
   use             linux
   host_name       Shinken_slave
   address         X.X.X.X
   _SNMPCOMMUNITY  DOmonitoring
}

  • The “use linux” is the “template” line. It mean that this host will use properties from the default linux template.

  • The “host_name” is the object name of your host. It corresponds to the hostname of our client and must be unique.

  • The “address” is the IP address of the slave or its FQDN.

  • The “_SNMPCOMMUNITY” is the custom SNMP community string or the password.

As we mentioned before, we’re going to use two packages for monitoring FTP & SSH services. These packages will check the state of publicly available services, applications and protocols without any special access requirements. For that we’re going to add them to the host definition file, on the line ‘use’ separated by a comma. We can use as much as we can, but we need to remember that we only need to monitor what is important.

The previous /usr/local/shinken/etc/hosts/shinken_slave.cfg will look like this:

define host{
   use             linux,ftp,ssh
   host_name       Shinken_slave
   address         X.X.X.X
   _SNMPCOMMUNITY  DOmonitoring
}

As we mentioned before, we are going to use a custom SNMP community string (password) for our client. For this guide, we chose “DOmonitoring” – it will be the same on the client.

Now that we declared our host, let’s restart Shinken to process the changes:

service shinken restart

Configuring the client:

We’ll start by installing SNMP on our client.

apt-get install snmpd

Then we configure Community strings and listening interfaces.

Edit the /etc/snmp/snmpd.conf and comment the line:

agentAddress  udp:127.0.0.1:161

Then, uncomment the line:

agentAddress udp:161,udp6:[::1]:161

As we already mentioned before, we are going to change the SNMP community (password) for our client by changing the default value “public” by a customised one. For the purpose of this tutorial, “DOmonitoring” will be chosen.

Replace :

rocommunity public

With:

rocommunity DOmonitoring

Restart the snmpd daemon:

service snmpd restart

Accessing the WebUI

For now, our monitoring server and client are configured. We need to access the Shinken Web UI using the IP address of our server http://X.X.X.X:7767.

<img src=“https://assets.digitalocean.com/articles/Shrinken_Ubuntu/1.png”>

Once authenticated, we will see a blank page saying “You don’t have any widget yet?”

We will configure it later with custom widgets to get the information needed, but first we need to check if our client is configured and reachable by the server.

Click on All tab and you will see a list of all monitored machines, including the server(localhost).

On the same list you should find Shinken_slave like :

<img src=“https://assets.digitalocean.com/articles/Shrinken_Ubuntu/2.png”>

Let’s go back the dashboard and create one by adding three widgets. Since we have only one monitored droplet, we will add graph, problems and relation widgets.

Click on add a widget then choose the one you want from the panel. By default, the widgets will get the localhost (monitoring server) states and informations. We can edit them to reflects the host we want by clicking and specifying the “Element name” as shown:

<img src=“https://assets.digitalocean.com/articles/Shrinken_Ubuntu/3.png”>

<img src=“https://assets.digitalocean.com/articles/Shrinken_Ubuntu/4.png”>

Our monitoring server will keep an eye on our VPS and track of all the changes. The longer the server runs, the more interesting the graphs and stats will become.

<div class=“author”>Article Submitted by: <a href=“https://twitter.com/mzahrane”>Mouad Zahrane</a></div>

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors
Default avatar
Mouad Zahrane

author

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
5 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Hello, Is it possible to install shinken to monitor VPS where it’s installed or do I need to have at least two droplets for that?

Hi,

Nice tutorial! However I would suggest not to use the install script. This is deprecated in version >= 2.0. This script was great but we decided to drop it because it was really hard to maintain for all distro / software version.

By the way, which version is used in this tutorial? If it’s 1.4.2 you may use debian package to install it ;). Otherwise pip is for now the best way.

I also give you the link to the new documentation, so that you can add it to this tutorial : https://shinken.readthedocs.org/en/latest/

Thanks for using Shinken!

Seb

Andrew SB
DigitalOcean Employee
DigitalOcean Employee badge
May 5, 2014

Like sdpagent said above, you need to install pymongo for the dashboard WebUI:

<pre> sudo apt-get install python-pip -y pip install pymongo service shinken restart </pre>

I followed this tutorial exactly yet when logged into Shinken, got a few problems. Firstly the VPS I’m monitoring, which is also the host on which this is running, reports that it is down with “Errno 2] No such file or directory” appearing on each line.

Also, when clicking on the Dashboard, I get the message about not defining a WebUI module. When I ran the commands to install MongoDB, reported back that MongoDB is already installed?

I’d love to get this working. Any ideas?

Thanks for the tutorial, I just spun up another Digi VPS to have this. On Ubuntu 14.04, I had to install pymongo and reboot before I could get rid of that "you didn’t define a WebUI module for saving user preference like the Mongodb one. " message. Commands below:

sudo apt-get install python-pip -y pip install pymongo sudo reboot

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.