How to install Sensu Go on Ubuntu 20.04 LTS

How To Install Sensu Go On Ubuntu 20.04 LTS

On this article we will describe how to install Sensu Go, a cross-platform monitoring tools on Linux Ubuntu 20.04 LTS operating system. Sensu Go included : Sensu backend, sensuctl (Sensu command line tool) and Sensu Agent.

Introduction

Sensu Go is a cross-platform monitoring software which is used to monitor different environments like public, private and hybrid cloud, and container-based environments. Sensu Go is operator-focused and developer-friendly and integrates with popular monitoring and observability tools. Sensu Go has two version option based on license, namley : open source and commercial version. On this article we will discuss how to install the latest version of Sensu Go open version , version 6.2.5 on Ubuntu 20.04 LTS operating system.



Sensu Go Installation on Ubuntu 20.04 LTS

Sensu Go has three main primary components that are listed below:

  • Sensu backend – It is a service that manages check requests and observability data.
  • Sensu Agent – It is a lightweight client that runs on the infrastructure components you want to monitor.
  • Sensuctl – It is a command-line tool for managing resources within Sensu.

Before installation is starting, we have to update Ubuntu package by submitting command line : sudo apt update.

ramans@otodiginet:~$ sudo apt update
 [sudo] password for ramans: 
 Hit:1 http://mirror.telkomuniversity.ac.id/ubuntu focal InRelease
 Get:2 http://mirror.telkomuniversity.ac.id/ubuntu focal-updates InRelease [114 kB]
 Get:4 http://mirror.telkomuniversity.ac.id/ubuntu focal-backports InRelease [101 kB]                            
 Hit:5 http://ppa.launchpad.net/teejee2008/ppa/ubuntu focal InRelease           
 Get:3 https://dl.bintray.com/apache/cassandra 40x InRelease [3,182 B]                                       
 Get:6 https://dl.bintray.com/apache/cassandra 311x InRelease [3,903 B]

1. Install Sensu Go Backend

1.1. Download Sensu Go Backend Repository

Sensu Go has provided us with a script to add its repository to our system in a very convenient way. By submitting command line : curl -s https://packagecloud.io/install/repositories/sensu/stable/script.deb.sh | sudo bash.

 ramans@otodiginet:~$ curl -s https://packagecloud.io/install/repositories/sensu/stable/script.deb.sh | sudo bash
 Detected operating system as Ubuntu/focal.
 Checking for curl…
 Detected curl…
 Checking for gpg…
 Detected gpg…
 Running apt-get update… done.
 Installing apt-transport-https… done.
 Installing /etc/apt/sources.list.d/sensu_stable.list…done.
 Importing packagecloud gpg key… done.
 Running apt-get update… done.
 The repository is setup! You can now install packages.
Adding Repository for Sensu backed
Adding Repository for Sensu backed

1.2. Install Sensu Go Backend

After package was downloaded, then we will begin installing Sensu Backend packages by submitting command line : sudo apt-get install sensu-go-backend.

ramans@otodiginet:~$ sudo apt-get install sensu-go-backend
 Reading package lists… Done
 Building dependency tree       
 Reading state information… Done
 The following packages were automatically installed and are no longer required:
   libfprint-2-tod1 libllvm9
 Use 'sudo apt autoremove' to remove them.
 The following NEW packages will be installed:
   sensu-go-backend
 0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
 Need to get 15.2 MB of archives.
 After this operation, 41.5 MB of additional disk space will be used.
 Get:1 https://packagecloud.io/sensu/stable/ubuntu focal/main amd64 sensu-go-backend amd64 6.2.6-4389 [15.2 MB]
 Fetched 15.2 MB in 13s (1,157 kB/s)                                                                               
 Selecting previously unselected package sensu-go-backend.
 (Reading database … 196166 files and directories currently installed.)
 Preparing to unpack …/sensu-go-backend_6.2.6-4389_amd64.deb …
 Unpacking sensu-go-backend (6.2.6-4389) …
 Setting up sensu-go-backend (6.2.6-4389) …
Sensu Backend Installation

1.3. Configure and Start Sensu Go Backend

After Sensu Backend installation was completed done, then we will configure and start its service. The steps will be executed by submitting command lines below :



  1. Copy the config template from the docs
    sudo curl -L https://docs.sensu.io/sensu-go/latest/files/backend.yml -o /etc/sensu/backend.yml
  2. Start sensu-backend using a service manager
    sudo service sensu-backend start
  3. Verify that the backend is running
    service sensu-backend status
ramans@otodiginet:~$ sudo curl -L https://docs.sensu.io/sensu-go/latest/files/backend.yml -o /etc/sensu/backend.yml
   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                  Dload  Upload   Total   Spent    Left  Speed
 100  1768  100  1768    0     0   1265      0  0:00:01  0:00:01 --:--:--  1265
ramans@otodiginet:~$ sudo service sensu-backend start
ramans@otodiginet:~$ sudo systemctl status sensu-backend
 ● sensu-backend.service - The Sensu Backend service.
      Loaded: loaded (/lib/systemd/system/sensu-backend.service; disabled; vendor preset: enabled)
      Active: active (running) since Fri 2021-03-26 18:33:40 PDT; 20s ago
    Main PID: 8270 (sensu-backend)
       Tasks: 14 (limit: 9450)
      Memory: 18.9M
      CGroup: /system.slice/sensu-backend.service
              └─8270 /usr/sbin/sensu-backend start -c /etc/sensu/backend.yml
 Mar 26 18:33:52 otodiginet sensu-backend[8270]: {"backend_id":"d4fc6d17-b153-4cb4-a6f4-c61e3d57980a","component":"metr>
 Mar 26 18:33:53 otodiginet sensu-backend[8270]: {"backend_id":"d4fc6d17-b153-4cb4-a6f4-c61e3d57980a","component":"metr>
 Mar 26 18:33:56 otodiginet sensu-backend[8270]: {"cache_version":"v1","component":"cache","level":"debug","msg":"rebui>
 Mar 26 18:33:56 otodiginet sensu-backend[8270]: {"cache_version":"v2","component":"cache","level":"debug","msg":"rebui>
 Mar 26 18:33:56 otodiginet sensu-backend[8270]: {"cache_version":"v1","component":"cache","level":"debug","msg":"rebui>
 Mar 26 18:33:56 otodiginet sensu-backend[8270]: {"cache_version":"v2","component":"cache","level":"debug","msg":"rebui>
 Mar 26 18:33:56 otodiginet sensu-backend[8270]: {"component":"tessend","level":"debug","metric_name":"asset_count","me>
 Mar 26 18:33:56 otodiginet sensu-backend[8270]: {"backend_id":"d4fc6d17-b153-4cb4-a6f4-c61e3d57980a","component":"metr>
 Mar 26 18:33:57 otodiginet sensu-backend[8270]: {"backend_id":"d4fc6d17-b153-4cb4-a6f4-c61e3d57980a","component":"metr>
 Mar 26 18:33:58 otodiginet sensu-backend[8270]: {"backend_id":"d4fc6d17-b153-4cb4-a6f4-c61e3d57980a","component":"metr>
Senus Backend has been started and running
Senus Backend has been started and running

While the Sensu backend is running, we need to run sensu-backend init to set up Sensu administrator username and password. In this initialization step, we only need to set environment variables with a username and password string — no need for role-based access control (RBAC). We just need to execute the command line below:

export SENSU_BACKEND_CLUSTER_ADMIN_USERNAME=admin
export SENSU_BACKEND_CLUSTER_ADMIN_PASSWORD=digiadm1n
sensu-backend init

ramans@otodiginet:~$ export SENSU_BACKEND_CLUSTER_ADMIN_USERNAME=admin
ramans@otodiginet:~$ export SENSU_BACKEND_CLUSTER_ADMIN_PASSWORD=digiadm1n
ramans@otodiginet:~$ sensu-backend init
{"component":"backend.seeds","level":"info","msg":"seeding etcd store with intial data","time":"2021-03-26T18:39:59-07:00"}
{"component":"store","level":"warning","msg":"migrating etcd database to a new version","time":"2021-03-26T18:40:00-07:00"}
{"component":"store","database_version":1,"level":"info","msg":"successfully upgraded database","time":"2021-03-26T18:40:00-07:00"}
{"component":"store","database_version":2,"level":"info","msg":"successfully upgraded database","time":"2021-03-26T18:40:00-07:00"}
 sensu-backend init
sensu-backend init

1.4. Open Sensu Go Web UI

The Sensu Go web UI provides a unified view of your observability events and user-friendly tools to reduce alert fatigue.
After starting the Sensu backend, we will use Web UI by visiting http://localhost:3000.

Sensu Go Login
Sensu Go Login
Sensu Go Dashboard

To verify Sens backend is up and running, use the Sensu HealtAPI to check the backend’s health.The response should be "Healthy": true.

amans@otodiginet:~$ curl http://127.0.0.1:8080/health
 {"Alarms":null,"ClusterHealth":[{"MemberID":9882886658148554927,"MemberIDHex":"8927110dc66458af","Name":"default","Err":"","Healthy":true}],"Header":{"cluster_id":4255616304056076734,"member_id":9882886658148554927,"raft_term":2}}



The Sensu backend has been installed on our system successfully, the next step is to install and configure sensuctl to connect to backend URL. Then we can install a Sensu agent and start monitoring our infrastructure.

2. Install Sensuctl

Sensuctl is a command line tool for managing resources within Sensu. It works by calling Sensu’s HTTP API to create, read, update, and delete resources, events, and entities. Sensuctl installation will be consist several steps below.

2.1. Add Sensuctl repository

Adding Sensuctl repository by downloading it to our system. Just submit the command line : curl -s https://packagecloud.io/install/repositories/sensu/stable/script.deb.sh | sudo bash.

ramans@otodiginet:~$ curl -s https://packagecloud.io/install/repositories/sensu/stable/script.deb.sh | sudo bash
 Detected operating system as Ubuntu/focal.
 Checking for curl…
 Detected curl…
 Checking for gpg…
 Detected gpg…
 Running apt-get update… done.
 Installing apt-transport-https… done.
 Installing /etc/apt/sources.list.d/sensu_stable.list…done.
 Importing packagecloud gpg key… done.
 Running apt-get update… done.

The repository is setup! You can now install packages.
Add Sensu Go Ctl Repository
Add Sensu Go ctl Repository

2.2. Install the sensu-go-cli package

On this step we will install sensu go cli on our system, by submitting command line : sudo apt-get install sensu-go-cli.

ramans@otodiginet:~$ sudo apt-get install sensu-go-cli
 Reading package lists… Done
 Building dependency tree       
 Reading state information… Done
 The following packages were automatically installed and are no longer required:
   libfprint-2-tod1 libllvm9
 Use 'sudo apt autoremove' to remove them.
 The following NEW packages will be installed:
   sensu-go-cli
 0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
 Need to get 10.5 MB of archives.
 After this operation, 29.3 MB of additional disk space will be used.
 Get:1 https://packagecloud.io/sensu/stable/ubuntu focal/main amd64 sensu-go-cli amd64 6.2.6-4389 [10.5 MB]
 Fetched 10.5 MB in 34s (307 kB/s)                                                                                    
 Selecting previously unselected package sensu-go-cli.
 (Reading database … 196181 files and directories currently installed.)
 Preparing to unpack …/sensu-go-cli_6.2.6-4389_amd64.deb …
 Unpacking sensu-go-cli (6.2.6-4389) …
 Setting up sensu-go-cli (6.2.6-4389) …
Install Sensu Go Ctl
Install Sensu Go Ctl

If we will use sensuctl, run sensuctl configure and log in with your user credentials, namespace, and Sensu backend URL. Here is the way to configure sensuctl using default values.

ramans@otodiginet:~$ sensuctl configure -n \
   --username 'admin' \
   --password 'digiadm1n' \
   --namespace default \
   --url 'http://127.0.0.1:8080'
   ramans@otodiginet:~$ sensuctl config view
   === Active Configuration
   API URL:                  http://127.0.0.1:8080
   Namespace:                default
   Format:                   tabular
   Timeout:                  15s
   Username:                 admin
   JWT Expiration Timestamp: 1616977593 
Sensu ctl
Sensu ctl

3. Install Sensu Agent

Sensu Agent a lightweight client that runs on the infrastructure components you want to monitor. For this tutorial we will install Sensu agent on the same Sensu Backend. Here is the step.

3.1. Add Sensu Agent repository

We wil add Sensu agent repository to our client monitored host, by submitting command line : curl -s https://packagecloud.io/install/repositories/sensu/stable/script.deb.sh | sudo bash.

ramans@otodiginet:~$ curl -s https://packagecloud.io/install/repositories/sensu/stable/script.deb.sh | sudo bash
 Detected operating system as Ubuntu/focal.
 Checking for curl…
 Detected curl…
 Checking for gpg…
 Detected gpg…
 Running apt-get update… done.
 Installing apt-transport-https… done.
 Installing /etc/apt/sources.list.d/sensu_stable.list…done.
 Importing packagecloud gpg key… done.
 Running apt-get update… done.
 The repository is setup! You can now install packages.

3.2 Install sensu-go-agent Package

After Sensu agent was added, then we will install it on the host, by submitting command line : sudo apt-get install sensu-go-agent.

ramans@otodiginet:~$ sudo apt-get install sensu-go-agent
ramans@otodiginet:~$ service sensu-agent start

3.3 Configure and Start Sensu Agent Servce

After all are set, then we will configure Sensu agent on the client and starting it. We will use the command line : service sensu-agent start.

Sensu Agens starting service
Sensu Agens starting service

3.4 Verify Sensu Agent

The we need to confirm if the agent is registered with Sensu and is sending keepalive events, open the entity page in the Sensu web UI or run sensuctl entity list.

 ramans@otodiginet:~$ sensuctl entity list
       ID       Class    OS       Subscriptions               Last Seen            
  ──────────── ─────── ─────── ─────────────────── ─────────────────────────────── 
   otodiginet   agent   linux   entity:otodiginet   2021-03-28 17:29:13 -0700 PDT  

Sensu Go dashboard after adding Sensu agent on the monitored server.

Sensu Go Dashboard
Sensu Go Dashboard

Conclusion

The Sensu Go Installation on Ubuntu 20.04 LTS has been completed done. I hope it will help you in Sensu Go Monitoring tools installaion. For more detail about Senso Go installation man configuration can be found on Sensu Go official web page.

Share this article via :

Leave a Reply

Your email address will not be published. Required fields are marked *