Linux, Windows, Virtualization, OpenSource & Blogging

Install Sensu on Ubuntu 16.04 / Debian 9 / Debian 8 – Monitor Your Infrastructre and Application

0
Install Sensu on Ubuntu 16.04
Install Sensu on Ubuntu 16.04

Sensu is an open-source application and infrastructure monitoring solution, designed to solve monitoring challenges introduced by a mix of infrastructures (i.e., public, private, and hybrid clouds).

Sensu services use a message bus (i,e. RabbitMQ) to communicate check requests and check results, the data’s related to check, event, client information are stored persistently in Data store (i,e. Redis).

Sensu server publishes and schedules check execution requests to client subscriptions. Subscriptions can be simply referred as a list of roles (i,e. web server, database, os type), determines which checks are executed by the client.

Client machine runs Sensu client software, a fully featured monitoring agent that does the client registration, subscriptions, local check execution (scheduled by Sensu client, not by Sense server), and check requests scheduled by Sensu server.

When there is a check, for ex. to check the status of Apache web server. The check will run on the Sensu client. If the check reports a service down, then the Sensu server will pass the result to event processor which processes the check results and takes action like sending an email or notifying in dashboard via RESTful API.

Article Series:

PART 1Install Sensu on Ubuntu 16.04 / Debian 9 / Debian 8

PART 2: Install Uchiwa – Dashboard for Sensu Core Monitoring Tool

PART 3: How to Add Remote Linux Host into Sensu Monitoring Tool

Release:

Sensu Core – an open source software project, released under a permissive MIT License.

Sensu Enterprise – the commercial version of Sense Core with added features, support, training, and many other benefits.

Features:

The following are the advantages of Sensu,

  • Monitor servers, application health, services, and business KPIs
  • Alerting and Notifications
  • Dynamic client registration and de-registration
  • Can be automated with Chef, Puppet, and Ansible
  • Availability of commercial support

Environment:

HostName IP Address OS Purpose
server.itzgeek.local 10.128.0.3 Ubuntu 16.04 Sensu Server (Redis, RabbitMQ, and Uchiwa)
debian.itzgeek.local 10.128.0.4 Debian 9 Sensu Client

This guide will take you through the installation Sensu on Ubuntu 16.04 / Debian 8.

Install Redis:

To begin, install Redis on Sensu server.

sudo apt-get update
sudo apt-get -y install redis-server apt-transport-https

Start the Redis service, if required.

sudo service redis-server start

Verify that Redis is ready to use by running the below command.

redis-cli ping

Output

PONG

Install RabbitMQ:

Add Erlang repository as RabbitMQ runs on the Erlang runtime.

wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb

Add Erlang public key to your trusted key list.

wget -O- https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc |  sudo apt-key add -

Install RabbitMQ along with Erlang runtime using the following command.

sudo apt-get update && sudo apt-get install -y socat erlang-nox=1:19.3-1

RabbitMQ is included in standard Ubuntu and Debian repositories, but the versions are often quite old. This guide recommends you to install the latest version of RabiitMQ through the official repository.

wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.10/rabbitmq-server_3.6.10-1_all.deb

Install the RabbitMQ repository package.

sudo dpkg -i rabbitmq-server_3.6.10-1_all.deb

Proceed to the installation of RabbitMQ server.

sudo apt-get update && sudo apt-get install -y rabbitmq-server

Start RabbbitMQ service.

sudo service rabbitmq-server start

Create a RabbitMQ vhost and user for Sensu. Replace password with the password of your choice. You will need this account details later to configure the Sensu server.

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

Install Sensu Core:

Sensu offers official repositories for Debian and Ubuntu operating systems. The Sensu Core package includes sensu-server, sensu-api, and sensu-client.

Install GPG public key and add APT configuration file at /etc/apt/sources.list.d/sensu.list.

wget -O- https://sensu.global.ssl.fastly.net/apt/pubkey.gpg |  sudo apt-key add -
echo "deb https://sensu.global.ssl.fastly.net/apt sensu main" | sudo tee /etc/apt/sources.list.d/sensu.list

Install Sensu using the following command.

sudo apt-get update && sudo apt-get install -y sensu

Configure Sensu server:

On Debian and Ubuntu systems, Sensu will load configuration from /etc/sensu/config.json and /etc/sensu/conf.d/ directory.

Sensu processes require extra configuration to tell them how to connect to the RabbitMQ transport bus.

sudo nano /etc/sensu/conf.d/rabbitmq.json

Update the file with following values. Replace password with the password you chosen few steps back.

{
  "rabbitmq": {
    "host": "127.0.0.1",
    "port": 5672,
    "vhost": "/sensu",
    "user": "sensu",
    "password": "password"
  }
}

This guide does not cover securing transport (RabbitMQ), but we strongly recommend you to secure a Sensu installation.

READ: Secure the Sensu transport via SSL encryption

Create redis.json file to include the connection information for Sensu to access Redis.

sudo nano /etc/sensu/conf.d/redis.json

Add the below lines to the above file.

{
  "redis": {
    "host": "127.0.0.1",
    "port": 6379
  }
}

Create api.json file to include the connection information for Sensu to access API service.

sudo nano /etc/sensu/conf.d/api.json

Add below lines to the above file.

{
  "api": {
    "host": "localhost",
    "bind": "0.0.0.0",
    "port": 4567
  }
}

Sensu core does not come with the monitoring dashboard, so you would need to install Uchiwa which is an open source dashboard for Sensu.

READ: How to install Uchiwa dashboard.

That’s All, for now. Stay tuned for more articles on Sensu Monitoring Tool.

You might also like
Shares