Installing and configuring Sensu 2.0

The Sensu 2.0 binaries are statically linked and can be deployed to any Linux or Windows operating system. Select a platform from the dropdown above.

Install the Sensu Backend

The Sensu backend (sensu-backend) is a single statically linked binary that can be deployed via packages (.deb or .rpm) or Docker image. Sensu backend packages are available for Ubuntu/Debian and RHEL/CentOS.

1. Install the package

Ubuntu/Debian

Add the Sensu beta repository.

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

Install the packages from the Sensu beta repository.

sudo apt-get install sensu-backend

RHEL/CentOS

Add the Sensu beta repository.

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

Install the Sensu backend and agent packages.

sudo yum install sensu-backend

2. Create the configuration file

Copy the example backend config file to the default config path.

sudo cp /etc/sensu/backend.yml.example /etc/sensu/backend.yml

The backend config requires state-dir to be set. The example config sets state-dir to /var/lib/sensu by default.

3. Start the service

Start the services using systemd.

sudo systemctl start sensu-backend

You can verify that the services are properly running using the log files.

journalctl -u sensu-backend -f

NOTE: On Ubuntu 14.04, CentOS 6, and RHEL 6, use sudo /etc/init.d/sensu-backend start to start the backend and tail -f /var/log/sensu/sensu-backend.log to verify it.

Agent Installation

The Sensu Agent (sensu-agent) is a single statically linked binary that can be deployed via packages (.deb or .rpm) or Docker image. The agent is available for Ubuntu/Debian, RHEL/CentOS, and Windows.

1. Install the package

Ubuntu/Debian

Add the Sensu beta repository.

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

Install the packages from the Sensu beta repository.

sudo apt-get install sensu-agent

RHEL/CentOS

Add the Sensu beta repository.

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

Install the Sensu backend and agent packages.

sudo yum install sensu-agent

Windows

Download the Sensu agent binary.

2. Create the configuration file

Copy the example agent config file to the default config path.

sudo cp /etc/sensu/agent.yml.example /etc/sensu/agent.yml

In order for the agent to function, it will need to have a list of one or more backends to point to. This can be set by setting backend-url to the ip and port of a Sensu backend.

backend-url:
  - "ws://127.0.0.1:8081"

3. Start the service

Ubuntu/Debian/RHEL/CentOS

Start the services using systemd.

sudo systemctl start sensu-agent

You can verify that the services are properly running using the log files.

journalctl -u sensu-agent -f

NOTE: On Ubuntu 14.04, CentOS 6, and RHEL 6, use sudo /etc/init.d/sensu-backend start to start the backend and tail -f /var/log/sensu/sensu-backend.log to verify it.

Windows

Coming soon.

Docker

Sensu 2.0 can be run via Docker or rkt using the sensu/sensu image. When running Sensu from Docker there are a couple of things to take into consideration.

The backend requires 3 exposed ports and persistent storage. This example uses a shared filesystem. Sensu 2.0 is backed by a distributed database, and its storage should be provisioned accordingly. We recommend local storage or something like Throughput Optimized or Provisioned IOPS EBS if local storage is unavailable. The 3 exposed ports are:

  • 2380: Sensu storage peer listener (only other sensu-backends need access to this port)
  • 3000: Sensu dashboard (not yet complete)
  • 8080: Sensu API (all users need access to this port)
  • 8081: Agent API (all agents need access to this port)

We suggest, but do not require, persistent storage for sensu-agents. The Sensu Agent will cache runtime assets locally for each check. This storage should be unique per sensu-agent process.

How To

  1. Start the sensu-backend process

    docker run -v /var/lib/sensu:/var/lib/sensu -d --name sensu-backend -p 2380:2380 \
    -p 3000:3000 -p 8080:8080 -p 8081:8081 sensu/sensu:2.0.0-beta.3 sensu-backend start

  2. Start an agent In this case, we’re starting an agent whose ID is the hostname with the webserver and system subscriptions. This assumes that sensu-backend is running on another host named sensu.yourdomain.com. If you are running these locally on the same system, be sure to add --link sensu-backend to your Docker arguments and change the backend URL --backend-url ws://sensu-backend:8081.

    docker run -v /var/lib/sensu:/var/lib/sensu -d --name sensu-agent \
    sensu/sensu:2.0.0-beta.3 sensu-agent start --backend-url ws://sensu.yourdomain.com:8081 \
    --subscriptions webserver,system --cache-dir /var/lib/sensu

NOTE: You can configure the sensu-backend and sensu-agent log levels by using the --log-level flag on either process. Log levels include panic, fatal, error, warn, info, and debug, defaulting to warn.

sensuctl and Docker

It’s best to run sensuctl locally and point it at the exposed API port for your sensu-backend process. The sensuctl utility stores configuration locally, and you’ll likely want to persist it across uses. While it can be run from the docker container, doing so may be problematic.