How to Install and Configure Sensu Monitoring on CentOS 7

Updated on January 25, 2017
How to Install and Configure Sensu Monitoring on CentOS 7 header image

Introduction

Sensu is a free and open source monitoring solution that can be used to monitor server, application and various system services.

Sensu is written in Ruby that uses RabbitMQ to handle messages and Redis to store data. If you want to monitor your entire cloud environment, then Sensu may be a good option for you.

In this tutorial, we will cover the process of installing and configuring a Sense monitoring server on CentOS 7.

Prerequisites

  • A Minimal install of CentOS 7.
  • A sudo user.

Step 1: Update the System

Update the system packages and kernel to the latest available version:

sudo yum update -y
sudo shutdown -r now

Step 2: Installing Erlang

By default erlang is not available in default CentOS repositories. It is however available in the EPEL repository.

You can install the EPEL using the following command:

sudo yum install epel-release -y

Then we can install erlang:

sudo yum install erlang -y

Step 3: Installing RabbitMQ and Redis

To install RabbitMQ, we need to add its key as follows:

sudo rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc   

Then, install the latest version of RabbitMQ using the following command:

sudo rpm -Uvh http://www.rabbitmq.com/releases/rabbitmq-server/current/rabbitmq-server-3.6.6-1.el7.noarch.rpm

Enable the RabbitMQ management console using the following command:

sudo rabbitmq-plugins enable rabbitmq_management

Next, we will be installing Redis:

sudo yum install redis -y

Finally, we will start the RabbitMQ and Redis services and enable them to auto-start:

sudo systemctl start rabbitmq-server
sudo systemctl enable rabbitmq-server
sudo systemctl start redis

The next step is to create a RabbitMQ vhost, username, and password as follows:

sudo rabbitmqctl add_vhost /sensu
sudo rabbitmqctl add_user sensu sensu
sudo rabbitmqctl set_permissions -p /sensu sensu ".*" ".*" ".*"

Note: You should consider using a more secure password.

Step 4: Installing Sensu and Uchiwa

To install Sensu, we need to create a yum repository for in /etc/yum.repos.d:

sudo nano /etc/yum.repos.d/sensu.repo

Add the following lines:

[sensu]
name=sensu-main
baseurl=http://repos.sensuapp.org/yum/el/7/x86_64/
gpgcheck=0
enabled=1

Then save and close the file.

Next, install Sensu and Uchiwa using the following command:

sudo yum install sensu uchiwa -y

Sense has an example configuration file which can be used:

sudo cp /etc/sensu/config.json.example /etc/sensu/config.json

Start Sensu and Uchiwa and enable auto-start:

sudo systemctl start sensu-server
sudo systemctl start sensu-client
sudo systemctl start sensu-api
sudo systemctl start uchiwa
sudo systemctl enable sensu-server
sudo systemctl enable sensu-client
sudo systemctl enable sensu-api
sudo systemctl enable uchiwa

Step 5: Accessing Sensu

By default Sensu runs on port 3000 which is not enabled in firewalld by default. As such, we need to manually add it:

sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
sudo firewall-cmd --reload

To access the Sensu web UI, visit http://192.168.15.110:3000 in your browser.

This concludes our tutorial, thank you for reading.