Sunday, July 12, 2015

Manually Setting Up a Shinken Monitoring Server

We're mainly focusing on how to set up a Shinken monitoring server, today. Make sure not to skip the prerequisites if you'd like to learn more about Shinken, from a high level. When you're finished going through this guide, I'd urge you to learn about how to set up a Shinken client, as well.

Prerequisites: Check out this introductory guide to Shinken and Nagios. You'll need at least two virtual machines, one for the server, and one for the client, so it helps to be familiar with Vagrant and VirtualBox. This guide was written for Mac OS X users.

Preparing the Virtual Machines

mkdir shinken && cd shinken
vagrant init "ubuntu/trusty64"
# spin up the instances
vagrant up

# ssh into the server
vagrant ssh hostname1

Installing Shinken

# install dependencies
sudo apt-get update
sudo apt-get install python-pip python-pycurl python-cherrypy3 python-setuptools -y

# add the shinken user and install shinken
sudo adduser shinken
sudo pip install shinken

# add shinken user to sudoers
sudo adduser shinken sudo

# switch to shinken
su shinken

# initialize shinken
shinken --init

# enable shinken on boot for ubuntu
sudo update-rc.d shinken defaults

# start shinken
service shinken start

Configuring Shinken

Now, we're ready to install some modules.

# enable the dashboard
shinken install webui
shinken install auth-cfg-password

# allow for storing of user data
shinken install sqlitedb

We'll have to update some configuration files, next. Edit them to look like the embedding examples.

# enable the webui
vi /etc/shinken/brokers/broker-master.cfg
# add the auth module and sqlite db
vi /etc/shinken/modules/webui.cfg

Setting the Shinken Credentials

Make sure to add your own password into the following file:

vi /etc/shinken/contacts/admin.cfg

And finally, restart Shinken.

# restart shinken
service shinken restart

Now, navigate to http://192.168.33.10:7767 and login with "admin" as your username and your password.

Then, navigate to http://192.168.33.10:7767/all and notice that localhost is down with the following error: [Errno 2] No such file or directory. This is because we haven't install any monitoring plugins, yet..

Configuring Monitoring Plugins

One of the main draws of Shinken is it's compatibility with existing Nagios plugins. We're going to take a step to pull in some of those, next.

cd /opt
sudo wget --no-check-certificate https://www.monitoring-plugins.org/download/monitoring-plugins-2.1.1.tar.gz
sudo tar -xvf monitoring-plugins-2.1.1.tar.gz
cd monitoring-plugins-2.1.1

sudo ./configure --with-nagios-user=shinken --with-nagios-group=shinken --enable-libtap --enable-extra-opts --enable-perl-modules --libexecdir=/usr/lib/nagios/plugins
sudo make install

# restart shinken
service shinken restart

Now, when we navigate to http://192.168.33.10:7767/all, localhost will be up and being monitored by Shinken.

Search for Additional Plugins

# search for linux plugins
shinken search ssh

linux-ssh (naparuba) [pack,linux,ssh] : Linux checks based on SSH without any script on distant server
ssh (naparuba) [pack,ssh] : Checks for SSH
varnish-ssh (kokosny) [pack,linux,varnish,ssh] : varnish checks based on ssh

Installing Plugins

shinken install ssh

Configuring the Server to Recognize the Plugin

sudo vi /etc/shinken/hosts/localhost.cfg

Restart shinken.

service shinken restart

That concludes this article. You're ready to set up a Shinken client, now, so let's head over to that guide, next.

2 comments:

  1. Nice and clear guide, thanks! Everything worked fine up till the last picture, I could not see the entry for 'ssh', still just 'localhost' despite following the installation steps for ssh. Have tried adding other hosts and services, none of them show up in the web ui. Why not?

    shinken: ver 2.4.2, webui: "Shinken UI, 2011-2013"

    ReplyDelete