How to Install Sensu on Ubuntu 20.04

how to install sensu on ubuntu 20.04

Sensu is a free, open-source, and cross-platform monitoring tool used for monitoring system health and performance stats. The latest version of Sensu also known as a Sensu Go. It is designed for traditional servers, containers, applications, the cloud, and more.

Sensu Go is made from three of components:

Sensu-backend: It is used to perform monitoring operations.
Sensuctl: It is a command-line tool used to monitor resources within Sensu.
Agent: You will need to install the agent on a system that you want to monitor.

In this post, we will show you how to install Sensu Go on an Ubuntu 20.04 VPS.

Prerequisites

  • An Ubuntu 20.04 VPS (we’ll be using our SSD 2 VPS plan)
  • Access to the root user account (or access to an admin account with root privileges)

Step 1: Log in to the Server & Update the Server OS Packages

First, log in to your Debian 10 server via SSH as the root user:

ssh root@IP_Address -p Port_number

Once you login, update your system packages with the following command:

apt-get update -y

Step 2: Install Sensu Backend

Before starting, you will need to install some dependencies to your system. Run the following command to install all the required dependencies:

apt-get install curl gnupg unzip wget -y

After the installation, you will need to install Sensu backend repository to your system. You can install it using the following command:

curl -s https://packagecloud.io/install/repositories/sensu/stable/script.deb.sh | bash

Once the repository is installed, update the repository and install the Sensu backend with the following command:

apt-get update -y
apt-get install sensu-go-backend -y

Once installed, you will also need to download the Sensu sample configuration file to the /etc/ sensu directory. You can download it using the following command:

curl -L https://docs.sensu.io./sensu-go/latest/files/backend.yml -o /etc/sensu/backend.yml

Next, start the Sensu backend service and enable it to start at system reboot:

systemctl start sensu-backend
systemctl enable sensu-backend

You can also verify the status of the Sensu service using the following command:

systemctl status sensu-backend

You should see the following output:

● sensu-backend.service - The Sensu Backend service.
     Loaded: loaded (/lib/systemd/system/sensu-backend.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2021-04-06 05:37:09 UTC; 9s ago
   Main PID: 2774 (sensu-backend)
      Tasks: 10 (limit: 2353)
     Memory: 16.8M
     CGroup: /system.slice/sensu-backend.service
             └─2774 /usr/sbin/sensu-backend start -c /etc/sensu/backend.yml

At this point, Sensu backend is started and listening on port 3000. You can check it with the following command:

ss -antpl | grep 3000

Output:

LISTEN    0         4096                     *:3000                   *:*        users:(("sensu-backend",pid=2774,fd=18)) 

Step 3: Set Sensu Admin Password

Next, you will need to generate an admin username and password to access the Sensu dashboard. You can generate it using the following command:

sensu-backend init --interactive

You will be asked to provide Sensu admin username and password as shown below:

? Cluster Admin Username: admin
? Cluster Admin Password: *********
? Retype Cluster Admin Password: *********
{"component":"backend.seeds","level":"info","msg":"seeding etcd store with intial data","time":"2021-04-06T05:38:14Z"}
{"component":"store","level":"warning","msg":"migrating etcd database to a new version","time":"2021-04-06T05:38:14Z"}
{"component":"store","database_version":1,"level":"info","msg":"successfully upgraded database","time":"2021-04-06T05:38:14Z"}
{"component":"store","database_version":2,"level":"info","msg":"successfully upgraded database","time":"2021-04-06T05:38:14Z"}

Step 4: Access Sensu Dashboard

Now, open your web browser and access the Sensu dashboard using the URL http://your-server-ip:3000. You will be redirected to the Sensu login page:

install sensu on ubuntu 20.04

Provide your admin username, password and click on the SIGN IN button. You should see the Sensu dashboard on the following page:

sensu installation on ubuntu 20.04

Step 5: Install Sensuctl

You will also need to install the Sensuctl command-line utility to manage and monitor the Sensu using the command-line.

First, add the repository with the following command:

curl -s https://packagecloud.io/install/repositories/sensu/stable/script.deb.sh | bash

Next, install the Sensuctl using the following command:

apt-get install sensu-go-cli

Once installed, run the following command to configure Sensuctl:

sensuctl configure

Provide the same admin credentials that you have created before:

? Authentication method: username/password
? Sensu Backend URL: http://127.0.0.1:8080
? Namespace: default
? Preferred output format: tabular
? Username: admin
? Password: *********

Step 6: Install Sensu Go Agent

Next, you will need to install Sensu Go Agent package on each system that you want to monitor. You can install it by just running the following command:

apt-get install sensu-go-agent

Once installed, download the agent configuration file with the following command:

curl -L https://docs.sensu.io/sensu-go/latest/files/agent.yml -o /etc/sensu/agent.yml

Next, start the agent service using the following command:

service sensu-agent start

You can also verify the agent service with the following command:

service sensu-agent status

Output:

● sensu-agent.service - The Sensu Agent process.
     Loaded: loaded (/lib/systemd/system/sensu-agent.service; disabled; vendor preset: enabled)
     Active: active (running) since Tue 2021-04-06 05:42:26 UTC; 3s ago
   Main PID: 3820 (sensu-agent)
      Tasks: 7 (limit: 2353)
     Memory: 3.3M
     CGroup: /system.slice/sensu-agent.service
             └─3820 /usr/sbin/sensu-agent start -c /etc/sensu/agent.yml

Now, refresh the Sensu dashboard page. You should see the following page.

install sensu on ubuntu

Congratulations! You have successfully installed Sensu Go on Ubuntu 20.04 VPS.

You don’t need to install Sensu Go on Ubuntu 20.04 VPS if you are one of our clients, simply ask one of our system administrators to set up Sensu on Ubuntu for you. They are available 24/7 and always ready to help you out.

PS. If you liked this post, please share it with your friends on the social networks using the buttons below or simply leave a comment in the comments section. Thanks.

Leave a Comment