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 nowStep 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 -yThen we can install erlang:
sudo yum install erlang -yStep 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.rpmEnable the RabbitMQ management console using the following command:
sudo rabbitmq-plugins enable rabbitmq_managementNext, we will be installing Redis:
sudo yum install redis -yFinally, 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 redisThe 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.repoAdd the following lines:
[sensu]
name=sensu-main
baseurl=http://repos.sensuapp.org/yum/el/7/x86_64/
gpgcheck=0
enabled=1Then save and close the file.
Next, install Sensu and Uchiwa using the following command:
sudo yum install sensu uchiwa -ySense has an example configuration file which can be used:
sudo cp /etc/sensu/config.json.example /etc/sensu/config.jsonStart 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 uchiwaStep 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 --reloadTo access the Sensu web UI, visit http://192.168.15.110:3000 in your browser.
This concludes our tutorial, thank you for reading.