The Learn Sensu sandbox is a CentOS 7 virtual machine pre-installed with Sensu, InfluxDB, and Grafana.
It is intended for use as a learning tool; we do not recommend this tool as part of a production installation.
To install Sensu in production, please see the installation guide.
The sandbox startup process takes about five minutes.

NOTE: The sandbox configures VirtualBox to forward TCP ports 3002 and 4002 from the sandbox virtual machine to the localhost to make it easier for you to interact with the sandbox dashboards. Dashboard links provided in this tutorial assume port forwarding from the VM to the host is active.

4. SSH into the sandbox

Thanks for waiting! To start using the sandbox:

vagrant ssh

You should now have shell access to the sandbox and should be greeted with this prompt:

[sensu_go_sandbox]$

To exit out of the sandbox, use CTRL+D.
To erase and restart the sandbox, use vagrant destroy then vagrant up.
To reset the sandbox’s Sensu configuration to the beginning of this tutorial, use vagrant provision.

NOTE: The sandbox pre-configures sensuctl with the Sensu Go admin user, so you won’t have to configure sensuctl each time you spin up the sandbox to try out a new feature. Before installing sensuctl outside of the sandbox, read the first time setup reference to learn how to configure sensuctl.

Lesson #1: Create a Sensu monitoring event

First off, we’ll make sure everything is working correctly by using the sensuctl command line tool.
We can use sensuctl to see that our Sensu backend instance has a single namespace, default, and two users: the default admin user and the user created for use by a Sensu agent.

The sensu-go-sandbox keepalive event has status 0, meaning the agent is in an OK state and able to communicate with the Sensu backend.

We can also see the event and the entity in the Sensu dashboard.
Log in to the dashboard as the default admin user: username admin and password P@ssw0rd!.

Lesson #2: Pipe keepalive events into Slack

Now that we know the sandbox is working properly, let’s get to the fun stuff: creating a workflow.
In this lesson, we’ll create a workflow that sends keepalive alerts to Slack.
(If you’d rather not create a Slack account, you can skip ahead to lesson 3.)

1. Get your Slack webhook URL

If you’re already an admin of a Slack, visit https://YOUR WORKSPACE NAME HERE.slack.com/services/new/incoming-webhook and follow the steps to add the Incoming WebHooks integration, choose a channel, and save the settings.
(If you’re not yet a Slack admin, start here to create a new workspace.)
After saving, you’ll see your webhook URL under Integration Settings.

2. Register the Sensu Slack handler asset

Assets are shareable, reusable packages that make it easy to deploy Sensu plugins.
In this lesson, we’ll use the Sensu Slack handler asset to power a slack handler.

With the filter in place we should no longer be receiving messages in the Slack channel every time the sandbox entity sends a keepalive event.

Let’s stop the agent and confirm that we receive the expected warning message.

sudo systemctl stop sensu-agent

You should see the warning message in Slack after a couple of minutes, informing you that the sandbox entity is no longer sending keepalive events.

Before we go, start the agent to resolve the warning.

sudo systemctl start sensu-agent

Lesson #3: Automate event production with the Sensu agent

So far we’ve used the Sensu agent’s built-in keepalive feature, but in this lesson, we’ll create a check that automatically produces workload-related events.
Instead of sending alerts to Slack, we’ll store event data with InfluxDB and visualize it with Grafana.

3. Create an InfluxDB pipeline
Now let’s create the InfluxDB pipeline to store these metrics and visualize them with Grafana.
To create a pipeline to send metric events to InfluxDB, start by registering the Sensu InfluxDB handler asset.

The sensu-influxdb-handler asset is now ready to use with Sensu.
You can use sensuctl to see the complete asset definition.

sensuctl asset info sensu-influxdb-handler --format yaml

Open the influx-handler.json handler definition provided with the sandbox, and edit the runtime_assets attribute to include the sensu-influxdb-handler asset.

"runtime_assets": ["sensu-influxdb-handler"]

Now you can use sensuctl to create the influx-db handler.

sensuctl create --file influx-handler.json

We can use sensuctl to confirm that the handler has been created successfully.

sensuctl handler list

You should see the influx-db handler.
(If you’ve completed lesson #2, you’ll also see the keepalive handler.)

4. Create a check to monitor Nginx

Use the curl_timings-check.json file provided with the sandbox to create a service check that runs metrics-curl.rb every 10 seconds on all entities with the entity:sensu-go-sandbox subscription and sends events to the InfluxDB pipeline:

This check defines a metrics handler and metric format.
In Sensu Go metrics are a core element of the data model, so we can build pipelines to handle metrics separately from alerts.
This allows us to customize our monitoring workflows to get better visibility and reduce alert fatigue.

Because we configured a metric format, the Sensu agent is able to convert the Graphite-formatted metrics provided by the check command into a set of Sensu-formatted metrics (not shown in the output), which are then sent to the InfluxDB handler that reads Sensu-formatted metrics and converts them to a format InfluxDB accepts.
Metric support isn’t limited to just Graphite; the Sensu agent can extract metrics in multiple line protocol formats, including Nagios performance data.

About Sensu

The Sensu monitoring event pipeline empowers businesses to automate their monitoring workflows and gain deep visibility into their multi-cloud infrastructure, from Kubernetes to bare metal. Companies like Sony, Box.com, and Activision rely on Sensu to help deliver value faster, at scale.