Blog
September 5, 2015 Marie H.

Monitoring with Shinken

Monitoring with Shinken

Photo by <a href="https://unsplash.com/@amsterdamcityarchives?utm_source=cloudista&utm_medium=referral" target="_blank" rel="noopener">Amsterdam City Archives</a> on <a href="https://unsplash.com/?utm_source=cloudista&utm_medium=referral" target="_blank" rel="noopener">Unsplash</a>

Today, I set up Shinken to monitor our main site. Shinken is a Nagios Python rewrite that is designed to be very scalable and I am evaluating it as a monitoring solution.
Below I will go through the bare minimum to get a Linux host configured and monitored using Shinken. Note I am providing end to end instructions as if this is a brand new spun up instance in the cloud.

Install shinken on monitoring server

Prereqs

yum install perl-App-cpanminus gcc mysql55 mysql-devel sqlite nagios-plugins*
pip install cherrypy
cpanm Net::SNMP
cpanm Time::HiRes
cpanm DBI
cpanm DBD::mysql
ln -s /usr/lib64/nagios/ /usr/lib/nagios
chmod u+s /usr/lib/nagios/plugins/check_icmp
mkdir /usr/local/lib64/perl
ln -s /usr/lib/nagios/plugins/utils.pm /usr/local/lib64/perl/utils.pm

This should get you going with everything you need to get started. Now lets start setting up shinken.

Setup

yum update
adduser shinken
pip install --upgrade pip
pip install shinken
su - shinken
shinken --init
shinken install webui auth-cfg-password sqlitedb linux-snmp mysql http https ssh smtp

Configure broker-master

vim /etc/shinken/brokers/broker-master.cfg

Update the line:

modules
To
modules webui
This will load the webui module on 7767 but I run it behind nginx with a proxypass so I can have a nice easy url to remember.

Setup host config

vim /etc/shinken/hosts/server.cfg
define host{
        use                     linux-snmp,https,ssh,mysql
    contact_groups      admins
        host_name               domain.com # Domain you are monitoring
        address                 1.2.3.4 # Put the server your monitoring here
        }

Setup SNMP Community String

This one is easy, just modify /etc/shinken/resource.d/snmp.cfg with your SNMP community string.

Setup MySQL Credentials

Also, easy. Just modify /etc/shinken/resource.d/mysql.cfg with a user and password that we will set up on the monitored host in a short time.

Setting up the monitored host

yum install net-snmp net-snmp-libs net-snmp-utils
systemctl start snmpd.service
systemctl enable snmpd.service

Configure snmpd

vim /etc/snmp/snmpd.conf
com2sec AllUser         default         somepassword
group   AllGroup        v2c             AllUser
view    AllView         included        .1
access  AllGroup        ""      any     noauth  exact   AllView         none    none

Setup MySQL

mysql
GRANT usage ON *.* TO 'shinken'@'1.2.3.4' IDENTIFIED BY 'password';
flush privileges;

Starting it up

If all went well when we start up shinken everything will just work. If not, I recommend checking the logs at /var/logs/shinken/* as they can normally tell you what is missing or broken.

service shinken start

Tell your friends...