Sensu is a free open source tool used to make up the monitoring system you need. It is written in Ruby, it uses RabbitMQ to handle messages and Redis to store data. Sensu provides a framework for monitoring the infrastructure and application health. Sensu supports many platforms such as IBM AIX, Ubuntu, Debian, RedHat, CentOS, FreeBSD, Mac OS, Solaris, Windows, and so on. Sensu enables organizations to form an integrated monitoring solution that meets their unique business needs. Sensu provides hundreds of plug-ins that provide local tools for your business-dependent tools and services, including Web servers and proxies, databases, message queues, log aggregation, indexing, search, caching, network and system resources, configuration management, and Found, GM, Chef, Clack and so on.
In this tutorial, we will install Redis, RabbitMQ and Sensu on Ubuntu 16.04.
Claim
- The Ubuntu 16.04 server is installed on your system.
- Set the sudo privilege on the system to non-root users.
- The static IP address 192.168.0.227 is configured on your system.
Update the system
Before starting, it is recommended to update the system to the latest stable version. You can update the system by running the following command:
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get upgrade -y
After updating the system, restart the system to apply all updates using the following command:
sudo reboot
After rebooting, use sudo users to log in to your system and proceed to the next step.
Install and configure RabbitMQ
Before starting, RabbitMQ runs on Erlang, so you need to install Erlang into the system.
First, add the Erlang repository and the Erlang public key to your trust key list using the following command:
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
wget -O- https://packages.erlang-solutions.com/ubuntu/erlang_solutions .asc | sudo apt-key add -
sudo dpkg -i erlang-solutions_1.0_all.deb
wget -O- https://packages.erlang-solutions.com/ubuntu/erlang_solutions .asc | sudo apt-key add -
Next, use the following command to update the repository:
sudo apt-get update -y
Once the repository is updated, run the following command to install Erlang:
sudo apt-get install socat erlang-nox -y
Next, you need to download and install the latest version of the RabbitMQ repository into your system. You can do this by running the following command:
http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.10/rabbitmq-server_3.6.10-1_all.deb wget
sudo dpkg -i RabbitMQ-server_3.6.10-1_all.deb
sudo dpkg -i RabbitMQ-server_3.6.10-1_all.deb
After installing the repository, use the following command to update the repository:
sudo apt-get update -y
Finally, install the RabbitMQ server by running the following command:
sudo apt-get install rabbitmq-server -y
After the installation is complete, start the RabbitMQ service and start it with the following command:
sudo systemctl start rabbitmq-server
sudo systemctl enable rabbitmq-server
sudo systemctl enable rabbitmq-server
Next, you will need to create a RabbitMQ vhost and user for Sensu. You can do this by running the following command:
sudo rabbitmqctl add_vhost / sensu
sudo rabbitmqctl add_user sensu your-password
sudo rabbitmqctl set_permissions -p / sensu sensu ". *" "*" ". *"
sudo rabbitmqctl add_user sensu your-password
sudo rabbitmqctl set_permissions -p / sensu sensu ". *" "*" ". *"
When you are done, you can continue installing the Redis server.
Install Redis Server
Sensu uses the Redis server to store their data. By default, Sensu is available in the Ubuntu repository. You can install the Redis server by running the following command:
sudo apt-get install redis-server apt-transport-https -y
When the installation is complete, start the Redis server and start it by running the following command:
sudo systemctl start Redis-server
sudo systemctl enable Redis-server
sudo systemctl enable Redis-server
Upon completion, you can proceed to the next step.
Install and configure SensuBy default, Sensu is not available in the Ubuntu repository. Therefore, you need to add public keys and repositories to the system.
First, add the GPG key using the following command:
wget -O- https://sensu.global.ssl.fastly.net/apt/pubkey.gpg | sudo apt-key add -
Next, use the following command to create the sensu.list file in the /etc/apt/sources.list.d directory to add the Sensu repository:
sudo nano /etc/apt/sources.list.d/sensu.list
Add the following line:
deb https : //sensu.global.ssl.fastly.net/apt sensu main
Use the following command to save the file and update the repository:
sudo apt-get update -y
Once the repository is updated, install Sensu using the following command:
sudo apt-get install sensu -y
After installing Sensu, you will need to configure Sensu for RabbitMQ and Redis. By default, Sensu will load the configuration from the /etc/sensu/conf.d/ directory. As a result, you will need to create a profile for RabbitMQ, Redi, and Api.
First, create a rabbitmq.json file in the /etc/sensu/conf.d directory by running the following command:
sudo nano /etc/sensu/conf.d/rabbitmq.json
Add the following line to connect to the RabbitMQ instance:
{ "RabbitMQ" : { "Host" : "127.0.0.1" , "Port" : 5672 , "Vhost" : "/ sensu" , "User" : "sensu" , "password" : "your-password" } }
Save and close the file after completion.
Next, use the following command to create the redis.json file:
sudo nano /etc/sensu/conf.d/redis.json
Add the following line to include Connection information for Sensu to access Redis:
{ "redis" : { "host" : "127.0.0.1" , "port" : 6379 } }
Save and close the file after completion.
Next, create an api.json file that contains the connection information for Sensu's access API service by running the following command.
sudo nano /etc/sensu/conf.d/api.json
Add the following line:
{ "api" : { "host" : "localhost" , "bind" : "0.0.0.0" , "port" : 4567 } }
Once finished, save and close the file, and then you can proceed to the next step.
Install and configure the Sensu dashboard
By default, Sensu does not come with a dashboard to monitor Sensu through the web interface.
Therefore, you need to install an open source Dashboard Uchiwa in your system. By default, Uchiwa is not available in the Ubuntu repository. So, you need to add the Uchiwa repository to your system.
First, add the Uchiwa public key using the following command:
wget -O- https://sensu.global.ssl.fastly.net/apt/pubkey.gpg | sudo apt-key add -
Next, use the following command to create a Uchiwa repository: uchiwa..list file in the /etc/apt/sources.list.d directory.
sudo nano /etc/apt/sources.list.d/uchiwa.list
Add the following line:
deb https : //sensu.global.ssl.fastly.net/apt sensu main
Save the file, and then use the following command to update the repository:
sudo apt-get update -y
Once the repository is updated, use the following command to install Uchiwa:
sudo apt-get install uchiwa-y
After installing Uchiwa, create the Uchiwa configuration file using the following command:
sudo nano /etc/sensu/conf.d/uchiwa.json
Add the following line:
{ "Sensu" : [ { "name" : "Sensu" , "Host" : "localhost" , "Port" : 4567 , "timeout" : 10 } ], "round fan" : { "Host" : "0.0.0.0 " , " port " : 3000 , " refresh " : 10 } }
Save and close the file after completion.
Finally, restart the Sensu and Uchiwa services and use the following command to start their startup time:
sudo systemctl start sensu-server
sudo systemctl enable sensu-server
sudo systemctl start sensu-api
sudo systemctl enable sensu-api
sudo systemctl start sensu-client
sudo systemctl enable sensu-client
sudo systemctl start uchiwa
sudo systemctl enable uchiwa
sudo systemctl enable sensu-server
sudo systemctl start sensu-api
sudo systemctl enable sensu-api
sudo systemctl start sensu-client
sudo systemctl enable sensu-client
sudo systemctl start uchiwa
sudo systemctl enable uchiwa
Upon completion, you can proceed to the next step.
Visit the Sensu dashboardBefore accessing the Sensu dashboard, you will need to allow port 3000 through the UFW firewall.
First, install the UFW firewall by running the following command:
sudo apt-get install ufw -y
Once UFW is installed, enable the UFW service with the following command:
sudo ufw enable
Next, use the following command to allow port 3000 through the UFW firewall:
sudo ufw allow 3000
After configuring the firewall, open the web browser and enter the URL http://192.168.0.227:3000 , you will see the following page:
Next, click on the data center icon and you should see the Sensu server instance as follows:
Next, you will need to add a client to monitor the Sensu server itself. You can create a client.json file by creating:
sudo nano /etc/sensu/conf.d/client.json
Add the following line:
{ "client" : { "name" : "sensu-server" , "address" : "127.0.0.1" , "environment" : "management" , "subscriptions" : [ "dev" , "ubuntu" ], "socket " : { " bind " : " 127.0.0.1 " , " port " : 3030 } } }
When finished, save and close the file, and then restart the sensu-client service to apply these changes:
sudo systemctl restart sensu-client
Finally, check the client's status by clicking the client icon as follows:
in conclusion
Congratulations! You have successfully installed and configured the Sensu server on the Ubuntu 16.04 server. You can now easily add more clients as needed. If you have any questions, please send me a message.
Thank you for your visite .. ☺
Enjoy
0 Reviews:
Post Your Review