Guides 11792 Published by

The article explains how to turn a plain Ubuntu machine into a fully functional Sensu Go observability platform, starting with updating the system and installing essential tools like curl and gnupg. It then walks through adding the secure GPG key, setting up the repository, and finally installing the Sensu Go CLI, server, and agent packages in one step. After that, it covers bootstrapping an admin user and default namespace, enabling the services to start on boot, and verifying they’re running with simple status commands and a health‑check API call. Finally, it lists common pitfalls such as missing state directories or insecure default passwords, offering quick checks and fixes to help readers avoid typical installation headaches.



How to Install Sensu Go on Ubuntu Servers: A No‑Nonsense Guide

When you’re ready to turn your Ubuntu box into a full‑blown observability platform, installing Sensu Go is the first step. This article walks through the exact commands and tells you why each one matters so you can avoid the usual hiccups.

1. Prepare Your Server
sudo apt update && sudo apt upgrade -y
sudo apt install curl gnupg -y

Updating ensures you’re pulling from a fresh mirror, and curl/gnupg are the only prerequisites Sensu’s repo installer needs. I’ve seen people hit a dead end when they forget to run apt update; the subsequent apt install will silently fail or pull an old package.

2. Add the Sensu GPG Key and Repository
curl -fsSL https://packages.sensu.io/gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/sensu-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/sensu-archive-keyring.gpg] https://packages.sensu.io/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/sensu.list > /dev/null
sudo apt update

Why this step? The key protects you from a man‑in‑the‑middle attack; if the repo is compromised, your entire monitoring stack could be poisoned. Adding the correct Ubuntu codename ($(lsb_release -cs)) guarantees you pull the right binary for your distribution.

3. Install Sensu Go Packages
sudo apt install sensu-go-cli sensu-go-server sensu-go-agent -y

sensu-go-cli is handy for CLI management, server houses the API and dashboard, and agent runs on every node you want to monitor. Skipping the agent means you get a half‑finished system that never actually collects metrics.

4. Bootstrap Your First Sensu Cluster

Sensu Go ships with an empty configuration; before you start it up you need at least one admin user and a default namespace.

sudo sensuctl register --admin-password myStrongPassw0rd!

Replace myStrongPassw0rd! with something that won’t make your security team cry. I’ve seen folks launch a server, then lock themselves out because they forgot to set an admin password—security is not optional.

Create the default namespace if you haven’t already:

sudo sensuctl create namespace default
5. Start and Enable Services
sudo systemctl enable --now sensu-go-server sensu-go-agent

Enabling guarantees the services restart after a reboot, while --now starts them immediately. If you skip this step, you’ll have to remember to start them manually each time.

6. Verify Everything Is Running
sudo systemctl status sensu-go-server sensu-go-agent
curl -s http://localhost:8080/api/v2/health | jq .

The health check should return status":"ok". If you see a 404 or “service unavailable,” double‑check that the sensu-go-server process is listening on port 8080 and that your firewall isn’t blocking it.

7. Common Pitfalls
  • Missing /opt/sensu/var – Sensu expects this directory for its state files; if it doesn’t exist or lacks proper permissions, the agent will crash immediately.
  • Wrong sensuctl version – After an upgrade you might still have an old CLI binary on your $PATH. Run which sensuctl to confirm you’re using the one that came with the new packages.
  • Unsecured default admin account – Don’t leave the initial password in plain text or commit it to a script. Rotate it as soon as possible: sensuctl update user admin --new-password.

That’s all there is to it. Once those services are up, you can start adding checks, dashboards, and alerts. If something feels off, check the logs under /var/log/sensu/; they’re usually kinder than a cryptic error page.

Good luck—feel free to ping me if your Sensu Go install takes an unexpected detour!