Shinken is an open-source system and network monitoring tool written by Jean Gabes. It is compatible with Nagios and you can use the Nagios configuration and plugins without modifying.
Shinken comes with a large number of monitoring packages that makes it 5 times faster than Nagios. It is specially designed to run on all operating systems where Python runs. With Shinken, you can monitor different host resources like Disk Usage, Processor Load, Logs and network services like, SMTP, POP3, NNTP, SNMP, FTP, SSH and many more.
Shinken comes with a rich set of features including load balancing, multi-sites management, multi-platform, virtualization integration, and many more.
In this tutorial, we will explain how to install Shinken on Ubuntu 18.04 and how to add a Linux host to the monitoring system.
Requirements:
- Two servers running Ubuntu 18.04.
- A static IP address 192.168.0.2 configured on Shinken server and 192.168.0.3 configured on Shinken client.
- A root password configured on both servers.
Getting Started
First, it is recommended to update your system with the latest version. You can do it with the following command:
# apt-get update -y # apt-get upgrade -y
Next, you will also need to install some dependencies required by Shinken. You can install all of them using the following command:
# apt-get install python-pip python-pycurl python-cherrypy3 python-setuptools git -y
Once all the packages are installed, you will also need to install MongoDB and other python packages to your server. You can install it with the following command:
# apt-get install mongodb # pip install pymongo>=3.0.3 requests arrow bottle==0.12.8
Installing Shinken
Before installing Shinken, you will need to create a user for Shinken. You can create it with the following command:
# useradd -m -s /bin/bash shinken
Next, download the latest version of Shinken source from the Git repository.
# git clone https://github.com/naparuba/shinken.git
Once downloaded, change the directory to shinken and checkout the latest branch:
# cd shinken # git checkout 2.4.3
Finally, install the Shinken server with the following command:
# python setup.py install
Once the Shinken server has been installed, you should get the following output:
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 done
Next, start the Shinken server with the following command:
# /etc/init.d/shinken start
You should get the following output:
Starting scheduler:
...done.
Starting poller:
...done.
Starting reactionner:
...done.
Starting broker:
...done.
Starting receiver:
...done.
Starting arbiter:
...done.
Now, verify the Shinken service with the following command:
# /etc/init.d/shinken status
You should see the following output:
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 Shinken Web UI
By default, Shinken does not provide Web interface. So, you will need to install Webui2 on your server.
To install Shinken, log in to Shinken user with the following command:
# su - shinken
Run the following command to initialize the Shinken configuration:
shinken --init
You should get the following output:
Creating ini section paths
Creating ini section shinken.io
Saving the new configuration file /home/shinken/.shinken.ini
Next, install Shinken Webui2 as shown below:
shinken install webui2
Once installed, exit from the Shinken user and enable webui2 module in broker-master.cfg file:
nano /etc/shinken/brokers/broker-master.cfg
Change the following line:
modules webui2
Save and close the file. Then, configure Shinken webui2 admin username and password. You can do it by editing admin.cfg file:
nano /etc/shinken/contacts/admin.cfg
Change the file 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 }
Save and close the file when you are finished.
Installing Nagios-plugins
Next, you will need to install Nagios-plugins and Perl modules to your server. First, install Nagios-plugins with the following command:
# apt-get install nagios-plugins* cpanminus -y
Next, install Perl modules with the following command:
# cpanm Net::SNMP # cpanm Time::HiRes # cpanm DBI
Next, create a symbolik link for utils.pm and create a log directory with the following command:
# 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.log
Next, log in to Shinken user and install SSH and SNMP module with the following command:
# su - shinken shinken install ssh shinken install linux-snmp
Once you have done, you can proceed to configure the Shinken client.
Installing and Configuring Shinken Client
Shinken server is now ready for monitoring. It’s time to install and configure the Shinken client to monitored from the Shinken server.
First, log in to your Shinken client system and install snmp and snmpd tool with the following command:
# apt-get install snmp snmpd -y
Once both packages are installed, open the snmpd.conf file and define the SNMP password:
# nano /etc/snmp/snmpd.conf
Change the following lines:
#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-password
Save and close the file. Then, restart the snmpd service to apply the changes:
# systemctl restart snmpd
Next, log in to your Shinken server system and create a new configuration file for Shinken client:
# nano /etc/shinken/hosts/client.cfg
Add the following lines:
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
}
Save the file then open SNMP configuration file and define SNMP password which you have specified in Client system:
# nano /etc/shinken/resource.d/snmp.cfg
Make the following changes:
# default snmp community
$SNMPCOMMUNITYREAD$=your-password
Save the file and restart the Shinken service to apply the configuration changes:
# /etc/init.d/shinken restart
Accessing Shinken Webui2
Shinken server is now running and listening on port 7677. Open your web browser and access the Shinken Webui2 by visiting the URL http://192.168.0.2:7767. You will be redirected to the Shinken Webui2 login page:
Provide your admin username and password. Then, click on the Login button. You should see the Shinken dashboard in the following screen:
Now, click on the System > Status in the left pane. You should see the status of Shinken services in the following screen:
Next, click on the Groups and tags > Hosts groups. You should see the following screen:
Now, click on the All hosts button. You should see you all active hosts in the following screen:
Congratulations! you have successfully installed Shinken on Ubuntu 18.04 server and add monitoring hosts. You can now easily add other hosts to your server and start monitoring.