Installing Shinken 2.0 on Debian Wheezy
Until now, I had always used the famous Nagios / Centreon couple for my supervision. Only today the two projects do not get along too much. Nagios devs no longer bother to make their tool compatible with the Centreon historical overlay since version 4. And conversely, the Centreon team no longer seeks to add this to Nagios from the stable version of their engine named Centreon Engine. I tried to give the latter a chance. But after a few hours spent on Tibetan forums looking for a fix for an SQL error, I decided to start from scratch and find myself a new monitoring tool.
Shinken installation
Shinken needs a user to function.
1
|
useradd –m shinken
|
We move on to the installation of the python dependencies necessary for the installation
1
|
apt–get install python–pycurl python–setuptools python–pip
|
Shinken installation is done via pip
1
|
pip install shinken
|
This installation gives us the following tree structure
- / etc / shinken : all the configuration of the program
- / usr / bin / shinken- * : the daemon launch scripts
- / var / lib / shinken : shinken modules and monitoring plugins (we will come back to this)
- / var / log / shinken : top secret
We launch the tool with its init script
1
|
/etc/init.d/shinken start
|
By default, Shinken only supervises itself. Even more, this supervision is very light. If you take a look at the host configuration side under /etc/shinken/hosts/localhost.cfg, you can see that the latter uses a “template” named “generic-host” which just checks that the host is up.
We are going to add some more basic checks on our host. For this we will use a specialized pack. The packs are script boxes to supervise a particular device and are available on this page.
We go under the Shinken user to install the pack
1
|
su – shinken
|
The Shinken CLI needs to be initialized in order to generate the ini file containing the paths to the various tool configuration directories.
1
|
shinken —init
|
Now we can look for our Linux pack
1
|
shinken search linux
|
Which gives the following result
1
2
3
4
5
|
glances (david–guenault) [pack,system,linux,glances] : Standard check through checkglances.py and glances server
linux–snmp (naparuba) [pack,linux,snmp] : Linux checks based on SNMP
linux–ssh (naparuba) [pack,linux,ssh] : Linux checks based on SSH without any script on distant server
pack–glances (david–guenault) [pack,system,linux,glances] : Standard check through checkglances.py and glances server
raspberrypi (frescha) [pack,linux,raspberrypi,server,os] : Standard checks
|
We will choose the linux-ssh package which is an agent mode. The script opens an ssh connection to run a command on the remote server and retrieve the information. You should know that this mode is not the most recommended because it consumes more resources than a classic SNMP request.
1
|
shinken install linux–ssh
|
The pack is installed with all its plugins in the / var / lib / shinken / libexec / folder.
These plugins need a library named python-paramiko. We go back to root to perform this installation.
1
2
3
|
exit # pour repasser root
apt–get install python–paramiko
su – shinken # retour sur l’user shinken
|
These plugins launch an ssh connection on the remote server, in this case the local server in our case. We will therefore generate a pair of ssh keys and give the public key to the shinken user.
1
|
ssh–keygen
|
Do not enter a passphrase otherwise the script would wait for human intervention to enter it at each execution.
Deployment of the public key
1
|
ssh–copy–id –i ~/.ssh/id_rsa shinken@localhost
|
We will test a plugin to see that everything works perfectly
1
|
/var/lib/shinken/libexec/check_load_average_by_ssh.py –H localhost
|
What must give
1
|
Ok: load average is good 0.59,0.27,0.15 | load1=0.59;1.00;2.00;; load5=0.27;1.00;2.00;; load15=0.15;1.00;2.00;;
|
We will therefore add the linux-ssh tag to the definition of our host. For that we edit /etc/shinken/hosts/localhost.cfg
1
2
3
4
5
6
|
define host{
use linux–ssh,generic–host
contact_groups admins
host_name localhost
address localhost
}
|
For more details on the configuration of a host I refer you to the official documentation.
We relaunch shinken to take into account
1
|
/etc/init.d/shinken restart
|
Alerts can be viewed in the log file
1
|
tail –f /var/log/shinken/schedulerd.log
|
Well, a console is not great for displaying the status of our machines. We are going to install the Shinken web interface to make it more pleasant.
Installation of the web interface
The web interface is a module of the daemon broker which will read, interpret and display the results obtained in the log files.
The installation is done from the prompt of the user shinken
1
|
shinken install webui
|
The configuration is in the file /etc/shinken/modules/webui.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
define module {
module_name webui
module_type webui
host 0.0.0.0
port 7767
auth_secret CHANGE_ME
allow_html_output 1
max_output_length 1024
manage_acl 1
play_sound 0
login_text Welcome on Shinken WebUI
modules
}
|
This module must be added to the main broker in the /etc/shinken/brokers/broker-master.cfg file
1
|
modules webui
|
We relaunch shinken
1
|
/etc/init.d/shinken restart
|
And you connect to the web page via your browser at the address of the machine on the port defined in the configuration file of the webui module.
We log in using the admin identifiers found in the configuration file /etc/shinken/contacts/admin.cfg
1
2
3
4
5
6
7
8
|
define contact{
use generic–contact
contact_name admin
email shinken@localhost
pager 0600000000 ; contact phone number
password admin
is_admin 1
}
|
And the… .. fail!
It's normal, I reassure you. Authentication is managed by a module. It must be added. Let's take a look at the available authentication modules
1
|
shinken search webui auth
|
Who gives:
1
2
3
|
auth–cfg–password (naparuba) [module,auth,authentification,mod–auth–cfg–password,auth–cfg–password,cfg–password,webui] : Shinken module for UI authentification from simple password for configuration file
auth–htpasswd (naparuba) [module,webui,auth,authentification] : Shinken module for UI authentification from Apache passwd files
auth–pam (mingbo_wan) [module,auth,authentification,auth–cfg–pam,cfg–pam,webui] : Shinken module for UI authentification via pam
|
- cfg-password: simple authentication based on the password saved in the contact's conf.
- htpassword: based on an apache htaccess file
- active-directory: authentication based on AD or LDAP
We install the first
1
|
shinken install auth–cfg–password
|
There is nothing to declare in the module's conf file (/etc/shinken/modules/auth_cfg_password.cfg) but you still have to declare the latter as for the others in the webui module under / etc / shinken / modules / webui.cfg
1
|
modules auth–cfg–password
|
And the restart that goes with it
1
|
/etc/init.d/shinken restart
|
This time the login passes. In the “all” view you should see your host as well as all the services of the linux-ssh package.
It is normal to get a type error
1
|
Error : cannot fetch cpu stats values from host
|
The CPU information recovery plugin is based on the sysstat program. It must be installed on the system.
1
|
apt–get install sysstat
|
If we go to the “/ dashboard” view, we get a huge error message
This is also normal. The dashboard is specific to each user. The WebUI module needs to save the preferences of each user in a flat file or a database. Here we will use sqlite.
Installation via shinken user
1
|
shinken install sqlitedb
|
And we add the module to the Webui module under /etc/shinken/modules/webui.cfg
1
|
modules auth–cfg–password,sqlitedb
|
The famous restart
1
|
/etc/init.d/shinken restart
|
You can now add widgets on the page / dashboard
Here it is finished for the installation. In the next article I will talk about adding hosts and services. In the meantime there is still the official documentation.