Install and Configure Sensu-Go Monitoring on Debian 10

Install and Configure Sensu-Go Monitoring on Debian 10

- 5 mins

Sensu Monitoring Tool

Sensu(Sensu Core) is a free open-source monitoring tool. Sensu known as Sensu Go now. Sensu and Sensu Go are both open-source monitoring and event management tools, but they represent different versions of the same project, with Sensu Go being the newer and more advanced version. Here are the key differences.

Components of Sensu Go

Step 1: Install Sensu Backend

  1. Start by adding Sensu repository
curl -s https://packagecloud.io/install/repositories/sensu/stable/script.deb.sh | sudo bash

sensu1

  1. Install Sensu Backend:
   apt install sensu-go-backend
   

Step 2: Start Sensu Backend

  1. To start sensu backend, download the configuration file to the directory
curl -L https://docs.sensu.io/sensu-go/latest/files/backend.yml -o /etc/sensu/backend.yml
  1. Start and enable the Sensu backend service.
   systemctl start sensu-backend
   systemctl enable sensu-backend
   
  1. Verify sensu backend service status sensu2

Step 3: Configure Sensu Credentials

  1. You just need to set environment variables with a username and password string in this initialization phase.
export SENSU_BACKEND_CLUSTER_ADMIN_USERNAME=username
export SENSU_BACKEND_CLUSTER_ADMIN_PASSWORD=password

Once the backend is operational, execute “sensu-backend init” to establish your Sensu admin credentials. Prior to initialization, ensure that you’ve added sensu-backend to your $PATH by exporting it.

###sensu-backend locate###
$ whereis sensu-backend
sensu-backend: /usr/sbin/sensu-backend

###export sensu-backend###
$ echo "export PATH=\$PATH:/usr/sbin" | sudo tee -a /etc/profile
export PATH=$PATH:/usr/sbin
$ source /etc/profile

###initialize sensu-backend###
$ sensu-backend init

Step 4: Access Sensu Web UI

$ ss -plunt |grep 3000
tcp LISTEN 0 ...

Use the command below to send a request to the backend to ensure it is up and running.

$ curl http://127.0.0.1:8080/health
"Alarms":null, ...

Open your web browser and go to http://your-server-ip:3000 sensu3

Use your credentials created above to login. After Successful login you will get the following dashboard: sensu4

Step 5: Install Sensuctl command line utility

Sensuctl is a command-line utility for managing Sensu resources. It creates, reads, updates, and deletes resources, events, and entities by using Sensu’s HTTP API. Sensuctl repository to the server:

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

Install sensuctl by running the following command:

apt install sensu-go-cli

Run sensuctl configure and log in with your user credentials, namespace, and Sensu backend URL to begin using sensuctl. To set default values for sensuctl, follow these steps:

sensuctl configure -n --username username --password passord --namespace default --url 'http://127.0.0.1:8080'

Non-interactive mode is triggered by the -n flag in this case. To see your user profile, run sensuctl config view.

You can now update the admin password with the utility tool by entering the command:

sensuctl user change-password --interactive

sensu

Step 6: Install and Configure Sensu Go Agent

Subsequently, you’ll need to install the Sensu Go Agent package on every system you wish to monitor. In this demonstration, we’ll install the agent on debian10. Simply run the provided command to perform the installation:

Start by Adding the Sensu repository.

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

Run the following command to install Sensu Go Agent.

apt install sensu-go-agent

Once the agent is installed, run the following command to get the agent configuration file:

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

Start Sensu agent

systemctl start sensu-agent

Confirm sensu agent status: sensu

Configure sensu-agent by specify the Sensu backend URL as below.

Start Sensu agent

vi /etc/sensu/agent.yml
name: "node1"
namespace: "default"
backend-url:

-   "ws://192.168.64.14:8081" # (Sensu-go back-end)
    

Restart the service after saving the changes: systemctl restart sensu-agent

Now, go back to the Sensu dashboard page and reload it. The agent should have been included, as you can see sensu

or you can use sensuctl to confirm the event:

sensuctl entity list

sensu

:metal: :metal: :metal: :metal: :metal: :metal: :metal:


:memo: Thanks for reading.

Guneycan Sanli.


Guneycan Sanli

Guneycan Sanli

A person who like learning, music, travelling and sports.

comments powered by Disqus