Shinken is an open-source system and network monitoring tool written by Jean Gabes. It is compatible with Nagios, allowing you to reuse existing Nagios configurations and plugins without modification.
Shinken offers a wide range of monitoring capabilities and is designed to deliver high performance and scalability, with some benchmarks reporting performance up to five times faster than Nagios. As a Python-based application, it can run on various operating systems that support Python.
With Shinken, you can monitor system resources such as disk usage, CPU load, and log files, as well as network services including SMTP, POP3, NNTP, SNMP, FTP, SSH, and many others.
In this tutorial, we'll walk you through installing Shinken on Ubuntu 18.04 and adding a Linux host to your monitoring system.
Prerequisites
Before getting started, make sure you have:
- Two Cloud Servers running Ubuntu 18.04.
- Static IP addresses configured on both servers: 192.168.0.2 for the Shinken monitoring server and 192.168.0.3 for the Linux host you want to monitor.
- Root access to both servers.
Getting Started
First, it's recommended to update your system's package lists and upgrade the installed packages to their latest available versions.
Run the following commands:
# apt-get update -y
# apt-get upgrade -yNext, you'll need to install the dependencies required by Shinken. You can install them all with the following command:
# apt-get install python-pip python-pycurl python-cherrypy3 python-setuptools git -yOnce the dependencies are installed, you'll also need to install MongoDB and some additional Python packages.
Run the following commands:
# apt-get install mongodb
# pip install pymongo>=3.0.3 requests arrow bottle==0.12.8Installing Shinken
Before installing Shinken, you'll need to create a dedicated system user to run the monitoring service.
Create the user with the following command:
# useradd -m -s /bin/bash shinkenNext, clone the Shinken source code from its GitHub repository:
# git clone https://github.com/naparuba/shinken.gitOnce the repository has been cloned, navigate to the shinken directory and check out version 2.4.3:
# cd shinken
# git checkout 2.4.3Then, install Shinken by running the following command:
# python setup.py installOnce the installation is complete, you should see output similar to the following:
Extracting Shinken-2.4.3-py2.7.egg to /usr/local/lib/python2.7/dist-packages
Adding Shinken 2.4.3 to easy-install.pth file
Installed /usr/local/lib/python2.7/dist-packages/Shinken-2.4.3-py2.7.egg
Processing dependencies for Shinken==2.4.3
Finished processing dependencies for Shinken==2.4.3
Changing owner of /etc/shinken to shinken:shinken
Changing owner of /var/run/shinken to shinken:shinken
Changing owner of /var/log/shinken to shinken:shinken
Changing owner of /var/lib/shinken/ to shinken:shinken
Changing owner of /var/lib/shinken/libexec to shinken:shinken
Changing owner of /usr/bin/shinken-discovery to shinken:shinken
Changing owner of /usr/bin/shinken-poller to shinken:shinken
Changing owner of /usr/bin/shinken-broker to shinken:shinken
Changing owner of /usr/bin/shinken-receiver to shinken:shinken
Changing owner of /usr/bin/shinken-scheduler to shinken:shinken
Changing owner of /usr/bin/shinken to shinken:shinken
Changing owner of /usr/bin/shinken-reactionner to shinken:shinken
Changing owner of /usr/bin/shinken-arbiter to shinken:shinken
Shinken setup doneNext, start the Shinken service using the following command:
# /etc/init.d/shinken startYou should see output similar to the following:
Starting scheduler:
...done.
Starting poller:
...done.
Starting reactionner:
...done.
Starting broker:
...done.
Starting receiver:
...done.
Starting arbiter:
...done.To verify that all Shinken components are running correctly, execute the following command:
# /etc/init.d/shinken statusYou should see output similar to the following:
Checking status of scheduler
scheduler RUNNING (pid 18801)
...done.
Checking status of poller
poller RUNNING (pid 18839)
...done.
Checking status of reactionner
reactionner RUNNING (pid 18880)
...done.
Checking status of broker
broker RUNNING (pid 18922)
...done.
Checking status of receiver
receiver RUNNING (pid 18961)
...done.
Checking status of arbiter
arbiter RUNNING (pid 19007)
...done.Installing and Configuring the Shinken Web Interface
hinken does not include an enabled web interface by default, so you'll need to install the WebUI2 module to manage and monitor your infrastructure through a web browser.
First, switch to the Shinken user by running the following command:
# su - shinkenNext, initialize the Shinken configuration:
shinken --initYou should see the following output:
Creating ini section paths
Creating ini section shinken.io
Saving the new configuration file /home/shinken/.shinken.iniNow, install the WebUI2 module using the following command:
shinken install webui2Next, enable the WebUI2 module in the Shinken broker configuration file:
nano /etc/shinken/brokers/broker-master.cfgLocate the modules directive and configure it as follows:
modules webui2Save your changes and close the file.
You'll then need to configure the administrator credentials for the Shinken web interface.
Open the administrator contact configuration file:
nano /etc/shinken/contacts/admin.cfgUpdate the administrator contact definition as shown below:
define contact{
use generic-contact
contact_name admin
email shinken@localhost
pager 0600000000 ; contact phone number
password your-admin-password
is_admin 1
expert 1
}Once you've finished, save the file and close the editor.
Installing Nagios Plugins
Next, you'll need to install the Nagios plugins and the Perl modules required by Shinken.
First, install the Nagios plugins and cpanminus using the following command:
# apt-get install nagios-plugins* cpanminus -yThen, install the required Perl modules:
# cpanm Net::SNMP
# cpanm Time::HiRes
# cpanm DBINext, set the required permissions for the ICMP monitoring plugin, create a symbolic link to utils.pm, and set up the directory and log file for remote host monitoring:
# chmod u+s /usr/lib/nagios/plugins/check_icmp
# ln -s /usr/lib/nagios/plugins/utils.pm /var/lib/shinken/libexec/
# mkdir -p /var/log/rhosts/
# touch /var/log/rhosts/remote-hosts.logNow, switch to the Shinken user and install the SSH and Linux SNMP monitoring modules:
# su - shinken
shinken install ssh
shinken install linux-snmpOnce both modules are installed, you can proceed with configuring the Linux host you want to monitor.
Installing and Configuring the Shinken Client
Your Shinken server is now ready to monitor other systems. The next step is to configure the Linux host that Shinken will monitor.
First, connect to your Shinken client server and install the SNMP utilities and SNMP daemon:
# apt-get install snmp snmpd -yOnce both packages are installed, open the SNMP daemon configuration file:
# nano /etc/snmp/snmpd.confLocate the relevant settings and update them as shown below:
#agentAddress udp:127.0.0.1:161
agentAddress udp:161,udp6:[::1]:161
#rocommunity mypass default -V systemonly
#rocommunity6 mypass default -V systemonly
rocommunity your-passwordSave your changes and close the file.
Then, restart the SNMP daemon to apply the new configuration:
# systemctl restart snmpdNext, connect to your Shinken monitoring server and create a new host configuration file for the Linux server you want to monitor:
# nano /etc/shinken/hosts/client.cfgAdd the following configuration:
define host{
use generic-host,linux-snmp,ssh
contact_groups admins
host_name shinken-client
address 192.168.0.3 # Shinken Client IP address
_SNMPCOMMUNITY your-password # SNMP Pass Config on snmpd.conf
}Replace 192.168.0.3 with your Shinken client's IP address and your-password with the SNMP community string you configured earlier.
Save the file and close the editor.
Next, update the SNMP configuration on your Shinken server to use the same community string.
Open the following file:
# nano /etc/shinken/resource.d/snmp.cfgLocate the default SNMP community setting and update it as follows:
# default snmp community
$SNMPCOMMUNITYREAD$=your-passwordAgain, replace your-password with the SNMP community string configured on your Linux host.
Save the file and close the editor.
Finally, restart the Shinken service to apply the configuration changes:
# /etc/init.d/shinken restartYour Shinken monitoring server should now be configured to monitor the Linux host using SSH and SNMP.
Accessing the Shinken Webui2 Interface
Your Shinken server should now be running, with the WebUI2 interface listening on port 7767.
Open your web browser and navigate to the following URL: http://192.168.0.2:7767. You should see the Shinken WebUI2 login page, as shown below:
Enter the administrator username and password you configured earlier, then click Login.
Once you've logged in, the Shinken dashboard should appear:
To check the status of your Shinken services, navigate to System → Status in the left-hand menu.
You should see an overview of the running services, as shown below:
Next, navigate to Groups and Tags → Host Groups to view your configured host groups.
You should see the following screen:
Now, click All Hosts to display a list of all hosts configured in your monitoring system.
You should see your monitored hosts and their current status, as shown below:
Congratulations! You've successfully installed and configured Shinken on your Ubuntu 18.04 server and added your first Linux host for monitoring.
You can now add more hosts to your monitoring system, monitor their resources and services, and manage your infrastructure from the Shinken WebUI2 dashboard.