How to install Sensu Monitoring on Rocky Linux 9.4
To Install Sensu Monitoring On Rocky Linux 9.4
Introduction:
Sensu is a scalable, secure, integrated monitoring solution for your technology and server infrastructure which can be used to monitor servers, application health, and services, and send alerts notification to multiple targets with third-party integration.
Procedure:
Step 1: Check the OS version by using the below command.
[root@Linuxhelp ~]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="9.4 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.4"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.4 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2032-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.4"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.4"
Step 2: Install the Sensu backend, begin by adding the Sensu repositories by using the below command.
[root@Linuxhelp ~]# curl -s https://packagecloud.io/install/repositories/sensu/stable/script.rpm.sh | sudo bash
Detected operating system as rocky/9.
Checking for curl...
Detected curl...
Downloading repository file: https://packagecloud.io/install/repositories/sensu/stable/config_file.repo?os=rocky&dist=9&source=script
done.
Installing yum-utils...
Rocky Linux 9 - BaseOS 4.5 kB/s | 4.1 kB 00:00
Rocky Linux 9 - BaseOS 1.5 MB/s | 2.2 MB 00:01
Rocky Linux 9 - AppStream 4.8 kB/s | 4.5 kB 00:00
Rocky Linux 9 - AppStream 3.9 MB/s | 7.9 MB 00:02
Rocky Linux 9 - Extras 2.8 kB/s | 2.9 kB 00:01
sensu_stable-source 179 B/s | 819 B 00:04
sensu_stable-source 3.5 kB/s | 3.8 kB 00:01
Importing GPG key 0x0A3F7426:
Userid : "https://packagecloud.io/sensu/stable (https://packagecloud.io/docs#gpg_signing) <support@packagecloud.io>"
Fingerprint: CB16 05C4 E988 C91F 4382 49E3 A5BC 3FB7 0A3F 7426
From : https://packagecloud.io/sensu/stable/gpgkey
sensu_stable-source 43 B/s | 296 B 00:06
Dependencies resolved.
=====================================================================================================================
Package Architecture Version Repository Size
=====================================================================================================================
Installing:
yum-utils noarch 4.3.0-13.el9 baseos 35 k
Transaction Summary
=====================================================================================================================
Install 1 Package
Total download size: 35 k
Installed size: 23 k
Downloading Packages:
yum-utils-4.3.0-13.el9.noarch.rpm 371 kB/s | 35 kB 00:00
---------------------------------------------------------------------------------------------------------------------
Total 40 kB/s | 35 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : yum-utils-4.3.0-13.el9.noarch 1/1
Running scriptlet: yum-utils-4.3.0-13.el9.noarch 1/1
Verifying : yum-utils-4.3.0-13.el9.noarch 1/1
Installed:
yum-utils-4.3.0-13.el9.noarch
Complete!
Generating yum cache for sensu_stable...
Importing GPG key 0x0A3F7426:
Userid : "https://packagecloud.io/sensu/stable (https://packagecloud.io/docs#gpg_signing) <support@packagecloud.io>"
Fingerprint: CB16 05C4 E988 C91F 4382 49E3 A5BC 3FB7 0A3F 7426
From : https://packagecloud.io/sensu/stable/gpgkey
Generating yum cache for sensu_stable-source...
The repository is setup! You can now install packages.
Step 3: Confirmed the repository was added by using the below command.
[root@Linuxhelp ~]# cat /etc/yum.repos.d/sensu_stable.repo
[sensu_stable]
name=sensu_stable
baseurl=https://packagecloud.io/sensu/stable/el/9/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/sensu/stable/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
[sensu_stable-source]
name=sensu_stable-source
baseurl=https://packagecloud.io/sensu/stable/el/9/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/sensu/stable/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
Step 4: Once the repository has been added, install the Sensu Go backend by using the below command.
[root@Linuxhelp ~]# dnf install vim sensu-go-backend -y
Last metadata expiration check: 0:01:33 ago on Mon 24 Jun 2024 06:12:04 AM IST.
Package vim-enhanced-2:8.2.2637-20.el9_1.x86_64 is already installed.
Dependencies resolved.
=====================================================================================================================
Package Architecture Version Repository Size
=====================================================================================================================
Installing:
sensu-go-backend x86_64 6.11.0-7218 sensu_stable 16 M
Transaction Summary
=====================================================================================================================
Install 1 Package
Total download size: 16 M
Installed size: 41 M
Downloading Packages:
sensu-go-backend-6.11.0-7218.x86_64.rpm 6.1 MB/s | 16 MB 00:02
---------------------------------------------------------------------------------------------------------------------
Total 6.1 MB/s | 16 MB 00:02
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Running scriptlet: sensu-go-backend-6.11.0-7218.x86_64 1/1
Preparing : 1/1
Running scriptlet: sensu-go-backend-6.11.0-7218.x86_64 1/1
Installing : sensu-go-backend-6.11.0-7218.x86_64 1/1
Running scriptlet: sensu-go-backend-6.11.0-7218.x86_64 1/1
Verifying : sensu-go-backend-6.11.0-7218.x86_64 1/1
Installed:
sensu-go-backend-6.11.0-7218.x86_64
Complete!
Step 5: Download the main configuration file to /etc/sensu/backend.yml by using the below command.
[root@Linuxhelp ~]# 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 3241 100 3241 0 0 3971 0 --:--:-- --:--:-- --:--:-- 3966
Step 6: Start and Enable the Sensu backend service by using the below command.
[root@Linuxhelp ~]# systemctl start sensu-backend
[root@Linuxhelp ~]# systemctl enable sensu-backend
Created symlink /etc/systemd/system/multi-user.target.wants/sensu-backend.service → /usr/lib/systemd/system/sensu-backend.service.
Step 7: Confirm if the service is running by using the below command.
[root@Linuxhelp ~]# systemctl status sensu-backend
● sensu-backend.service - The Sensu Backend service.
Loaded: loaded (/usr/lib/systemd/system/sensu-backend.service; enabled; preset: disabled)
Active: active (running) since Mon 2024-06-24 06:16:07 IST; 30s ago
Main PID: 51343 (sensu-backend)
Tasks: 8 (limit: 48584)
Memory: 34.2M
CPU: 253ms
CGroup: /system.slice/sensu-backend.service
└─51343 /usr/sbin/sensu-backend start -c /etc/sensu/backend.yml
Jun 24 06:16:33 Linuxhelp sensu-backend[51343]: {"component":"etcd","level":"debug","caller":"v3rpc/interceptor.go:1>
Jun 24 06:16:33 Linuxhelp sensu-backend[51343]: {"component":"tessend","level":"debug","metric_name":"filter_count",>
Jun 24 06:16:33 Linuxhelp sensu-backend[51343]: {"backend_id":"7ff3ebca-3662-40ed-beca-0a8372523d2d","component":"me>
Jun 24 06:16:33 Linuxhelp sensu-backend[51343]: {"component":"etcd","level":"debug","caller":"v3rpc/interceptor.go:1>
Jun 24 06:16:34 Linuxhelp sensu-backend[51343]: {"backend_id":"7ff3ebca-3662-40ed-beca-0a8372523d2d","component":"me>
Jun 24 06:16:34 Linuxhelp sensu-backend[51343]: {"component":"etcd","level":"debug","caller":"v3rpc/interceptor.go:1>
Jun 24 06:16:35 Linuxhelp sensu-backend[51343]: {"backend_id":"7ff3ebca-3662-40ed-beca-0a8372523d2d","component":"me>
Jun 24 06:16:35 Linuxhelp sensu-backend[51343]: {"component":"etcd","level":"debug","caller":"v3rpc/interceptor.go:1>
Jun 24 06:16:36 Linuxhelp sensu-backend[51343]: {"backend_id":"7ff3ebca-3662-40ed-beca-0a8372523d2d","component":"me>
Jun 24 06:16:36 Linuxhelp sensu-backend[51343]: {"component":"etcd","level":"debug","caller":"v3rpc/interceptor.go:1>
lines 1-20/20 (END)
Step 8: Create the admin user and password by exporting the credentials by using the below command.
[root@Linuxhelp ~]# export SENSU_BACKEND_CLUSTER_ADMIN_USERNAME=admin
[root@Linuxhelp ~]# export SENSU_BACKEND_CLUSTER_ADMIN_PASSWORD=Admin@123
Step 9: Replace the username and password as preferred. For the changes to apply, initialize the backend by using the below command.
[root@Linuxhelp ~]# sensu-backend init
{"component":"cmd","level":"info","msg":"attempting to connect to etcd server: http://localhost:2379","time":"2024-06-24T06:18:16+05:30"}
{"component":"backend.seeds","level":"info","msg":"seeding etcd store with initial data","time":"2024-06-24T06:18:16+05:30"}
{"component":"store","level":"warning","msg":"migrating etcd database to a new version","time":"2024-06-24T06:18:16+05:30"}
{"component":"store","database_version":1,"level":"info","msg":"successfully upgraded database","time":"2024-06-24T06:18:16+05:30"}
{"component":"store","database_version":2,"level":"info","msg":"successfully upgraded database","time":"2024-06-24T06:18:16+05:30"}
{"component":"store","level":"warning","msg":"migrating enterprise etcd database to a new version","time":"2024-06-24T06:18:16+05:30"}
{"component":"store","database_version":1,"level":"info","msg":"successfully upgraded database","time":"2024-06-24T06:18:16+05:30"}
{"component":"store","database_version":2,"level":"info","msg":"successfully upgraded database","time":"2024-06-24T06:18:16+05:30"}
Step 10: The Sensu web UI runs on port 3000 by default, It allows users to view events and alerts on Sensu. So we will allow the required ports through the firewall by using the below commands.
[root@Linuxhelp ~]# firewall-cmd --add-port=3000/tcp --permanent
success
[root@Linuxhelp ~]# firewall-cmd --add-port=8080/tcp --permanent
success
[root@Linuxhelp ~]# firewall-cmd --add-port=8081/tcp --permanent
success
[root@Linuxhelp ~]# firewall-cmd --reload
success
Step 11: To verify if the backend is running as desired, use the cult command below to check its health.
[root@Linuxhelp ~]# curl http://127.0.0.1:8080/health
{"Alarms":null,"ClusterHealth":[{"MemberID":13195394291058371180,"MemberIDHex":"b71f75320dc06a6c","Name":"default","Err":"","Healthy":true}],"Header":{"cluster_id":2037210783374497686,"member_id":13195394291058371180,"raft_term":2}}
Step 12: Access the Sensu web UI using the URL http://IP_address:3000
Login using the created credentials to access the Sensu dashboard below.
Now you can view the dashboards and events in the preferred namespace.
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to use Variables and Global Variables using Asterisk Dialplan Context on Rocky Linux 9.4. Your feedback is much welcome.