Install Sensu Agent on Rocky Linux

Last Updated:

This guide will take you through how to install Sensu agent on Rocky Linux systems. In order to start collecting remote system metrics for monitoring using Sensu Go server, you need to install Sensu agents on the hosts being monitored.

Install Sensu Agent on Rocky Linux

To install Sensu agent on Rocky Linux;

  • Install Sensu RPM repository;
curl -s | sudo bash
  • Install Sensu Agent on Rocky Linux

Once the repository is installed, ran the command below to install Sensu agent on Rocky Linux;

sudo dnf install sensu-go-agent

Sample installation command output;

Dependencies resolved.
 Package                                     Architecture                        Version                                    Repository                                 Size
 sensu-go-agent                              x86_64                              6.7.1-6231                                 sensu_stable                              6.6 M

Transaction Summary
Install  1 Package

Total download size: 6.6 M
Installed size: 19 M
Is this ok [y/N]: y
Downloading Packages:
sensu-go-agent-6.7.1-6231.x86_64.rpm                                                                                                        1.1 MB/s | 6.6 MB     00:06    
Total                                                                                                                                       1.1 MB/s | 6.6 MB     00:06     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Running scriptlet: sensu-go-agent-6.7.1-6231.x86_64                                                                                                                   1/1 
  Preparing        :                                                                                                                                                    1/1 
  Running scriptlet: sensu-go-agent-6.7.1-6231.x86_64                                                                                                                   1/1 
  Installing       : sensu-go-agent-6.7.1-6231.x86_64                                                                                                                   1/1 
  Running scriptlet: sensu-go-agent-6.7.1-6231.x86_64                                                                                                                   1/1 
  Verifying        : sensu-go-agent-6.7.1-6231.x86_64                                                                                                                   1/1 
Installed products updated.



Configure and Run Sensu Agent

You can run Sensu agent with or without defining a configuration file.

To run without defining a configuration file on the foreground, use the command below

sudo -u sensu sensu-agent start --backend-url <sensu-server-web-socket-url>

Sensu backend web socket listens on port 8081. Ensure this port is opened on the Sensu backend server to allow agents to connect. The protocol is WS or WSS. (websocket on http/websocket on https)

sudo -u sensu sensu-agent start --backend-url ws://


sudo -u sensu sensu-agent start --backend-url ws://

Sample output;

{"component":"agent","level":"info","msg":"compacting api queue","time":"2022-05-07T02:42:24-04:00"}
{"component":"agent","level":"info","msg":"finished api queue compaction","time":"2022-05-07T02:42:24-04:00"}
{"component":"agent","level":"info","msg":"using password auth","time":"2022-05-07T02:42:24-04:00"}
{"component":"agent","level":"info","msg":"configuration successfully validated","time":"2022-05-07T02:42:24-04:00"}
{"component":"agent","level":"info","msg":"starting statsd server on address:","time":"2022-05-07T02:42:24-04:00"}
{"component":"agent","level":"info","msg":"starting UDP listener on address:","time":"2022-05-07T02:42:24-04:00"}
{"component":"agent","level":"info","msg":"starting api on address:","time":"2022-05-07T02:42:24-04:00"}
{"component":"agent","event":{"Title":"Gostatsd started","Text":"Gostatsd started","DateHappened":1651905744,"Hostname":"localhost.localdomain","AggregationKey":"","SourceTypeName":"","Tags":null,"SourceIP":"","Priority":1,"AlertType":0},"level":"info","msg":"statsd received an event","time":"2022-05-07T02:42:24-04:00"}
{"component":"agent","level":"info","msg":"starting TCP listener on address:","time":"2022-05-07T02:42:24-04:00"}
{"component":"agent","level":"info","msg":"connecting to backend URL \"ws://\"","time":"2022-05-07T02:42:24-04:00"}
{"component":"agent","level":"info","msg":"successfully connected","time":"2022-05-07T02:42:24-04:00"}
{"component":"agent","content_type":"application/octet-stream","level":"info","msg":"message received","payload_size":31,"time":"2022-05-07T02:42:25-04:00","type":"entity_config"}
{"check":"keepalive","component":"agent","entity":"localhost.localdomain","event_uuid":"48e54a4e-ddd6-4f0e-9f94-b78497385c28","level":"info","msg":"sending event to backend","time":"2022-05-07T02:42:25-04:00"}
{"component":"agent","content_type":"application/octet-stream","level":"info","msg":"message received","payload_size":169,"time":"2022-05-07T02:42:25-04:00","type":"entity_config"}
{"check":"keepalive","component":"agent","entity":"localhost.localdomain","event_uuid":"6d2b8024-bbfb-4f80-b1aa-252777e7daf7","level":"info","msg":"sending event to backend","time":"2022-05-07T02:42:45-04:00"}

To run Sensu agent as a service, you need a configuration file. Download and install the sample Sensu agent configuration file;

sudo curl -sL -o /etc/sensu/agent.yml

This is how sample config looks like;

# Sensu agent configuration

# agent configuration
#name: "hostname"
#namespace: "default"
#  - example
#  example_key: "example value"
#  example/key: "example value"
#agent-managed-entity: false
#allow-list: /etc/sensu/check-allow-list.yaml
#assets-burst-limit: 100
#assets-rate-limit: 1.39
#backend-handshake-timeout: 15
#backend-heartbeat-interval: 30
#backend-heartbeat-timeout: 45
#  - "ws://"
#cache-dir: "/var/cache/sensu/sensu-agent"
#config-file: "/etc/sensu/agent.yml"
#deregister: false
#deregistration-handler: "example_handler"
#detect-cloud-provider: false
#disable-assets: false
#keepalive-critical-timeout: 0
#  - slack
#  - email
#keepalive-interval: 20
#keepalive-warning-timeout: 120
log-level: "debug" # available log levels: panic, fatal, error, warn, info, debug
#user: "agent"
#password: "P@ssw0rd!"
#  - password
#  - passwd
#  - pass
#  - api_key
#  - api_token
#  - access_key
#  - secret_key
#  - private_key
#  - secret
#require-fips: false
#require-openssl: false

# api configuration
#api-host: ""
#api-port: 3031
#disable-api: false
#events-burst-limit: 10
#events-rate-limit: 10.0

# socket configuration
#socket-host: ""
#socket-port: 3030
#disable-sockets: false

# statsd configuration
#statsd-disable: false
#  - example_handler
#statsd-flush-interval: 10
#statsd-metrics-host: ""
#statsd-metrics-port: 8125

# tls configuration
#cert-file: "/path/to/tls/agent.pem"
#trusted-ca-file: "/path/to/tls/ca.pem"
#key-file: "/path/to/tls/agent-key.pem"
#insecure-skip-tls-verify: false

The default Sensu backend URL is ws://

If you are using a remove Sensu backend;

sudo vim /etc/sensu/agent.yml

update the backend url from;

#  - "ws://"

To (replace <sensu-backend-IP> with Sensu backend IP address);

  - "ws://<sensu-backend-IP>:8081"

At the very least, Sensu agent just requires the backend url to be defined.

Next, start and enable the Sensu agent service to run on system boot;

sudo systemctl enable --now sensu-agent

Check the Status;

systemctl status sensu-agent
● sensu-agent.service - The Sensu Agent process.
     Loaded: loaded (/lib/systemd/system/sensu-agent.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-05-07 01:17:26 EAT; 3s ago
   Main PID: 4246 (sensu-agent)
      Tasks: 7 (limit: 1133)
     Memory: 8.3M
        CPU: 62ms
     CGroup: /system.slice/sensu-agent.service
             └─4246 /usr/sbin/sensu-agent start -c /etc/sensu/agent.yml

May 07 01:17:27 debian11 sensu-agent[4246]: {"component":"agent","header":"Accept: application/octet-stream","level":"debug","msg":"setting header","time":"2022-05-07T01:1>
May 07 01:17:28 debian11 sensu-agent[4246]: {"component":"agent","level":"info","msg":"successfully connected","time":"2022-05-07T01:17:28+03:00"}
May 07 01:17:28 debian11 sensu-agent[4246]: {"component":"agent","header":"Accept: [application/octet-stream application/json]","level":"debug","msg":"received header","ti>
May 07 01:17:28 debian11 sensu-agent[4246]: {"component":"agent","format":"protobuf","level":"debug","msg":"setting serialization/deserialization","time":"2022-05-07T01:17>
May 07 01:17:28 debian11 sensu-agent[4246]: {"component":"agent","header":"Content-Type: application/octet-stream","level":"debug","msg":"setting header","time":"2022-05-0>
May 07 01:17:28 debian11 sensu-agent[4246]: {"component":"agent","level":"debug","msg":"maxSessionLength is 0s, agent won't periodically disconnect","time":"2022-05-07T01:>
May 07 01:17:28 debian11 sensu-agent[4246]: {"component":"agent","content_type":"application/octet-stream","level":"info","msg":"message received","payload_size":143,"time>
May 07 01:17:28 debian11 sensu-agent[4246]: {"component":"agent","level":"debug","msg":"received an entity config from the backend","time":"2022-05-07T01:17:28+03:00"}
May 07 01:17:28 debian11 sensu-agent[4246]: {"component":"agent","level":"debug","msg":"successfully received the initial entity config","time":"2022-05-07T01:17:28+03:00"}
May 07 01:17:28 debian11 sensu-agent[4246]: {"check":"keepalive","component":"agent","entity":"debian11","event_uuid":"14a4c0f8-301c-4fe2-9db3-119c8a53274a","level":"info

In case of any issue, check the logs using journalctl command;

journalctl -u sensu-agent

Sensu Agents listens on ports 3030/tcp,udp for the Sensu agent socket and 3031/tcp for Sensu API;

ss -altnp | grep sensu
LISTEN 0      4096*    users:(("sensu-agent",pid=1180,fd=10))
LISTEN 0      4096*    users:(("sensu-agent",pid=1180,fd=12))

Very Sensu Agents Connectivity with Sensu Backend Server

Login back to Sensu backend and confirm the status of the agents.

sensu agent rocky

As you can see, we have two remote agents under the default entity. sensu-system entity is the Sensu backend itself.

Install Sensu Agent on Rocky Linux

You can click on any of the respective agent entities to view more details;

Install Sensu Agent on Rocky Linux

And that is how you can easily install Sensu Agent on Rocky Linux.

Next, follow the guide below to learn how to monitor Linux system metrics using Sensu.

How to Monitor Linux System Metrics using Sensu


Install Sensu

Other Tutorials;

Install Sensu Go on Ubuntu 22.04

Install Sensu Agent on Ubuntu/Debian


We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
I am the Co-founder of, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

Leave a Comment