Process your observation data

or click any element in the pipeline to jump to it.

In the process stage, Sensu executes pipelines and handlers.

In the process stage of Sensu’s observability pipeline, the Sensu backend executes pipelines and handlers to take action on your observation data. Your pipeline or handler configuration determines what happens to the events that comes through your observability pipeline. For example, your pipeline or handler might route incidents to a specific Slack channel or PagerDuty notification workflow, or send metrics to InfluxDB or Prometheus.

Pipelines

Pipelines are Sensu resources composed of observation event processing workflows made up of filters, mutators, and handlers. Instead of specifying filters and mutators in handler definitions, you can specify all three in a single pipeline workflow.

This example shows a pipeline resource definition that includes an event filter, a mutator, and a handler:

---
type: Pipeline
api_version: core/v2
metadata:
  name: incident_alerts
  namespace: default
  created_by: admin
spec:
  workflows:
  - name: labeled_email_alerts
    filters:
    - name: is_incident
      type: EventFilter
      api_version: core/v2
    mutator:
      name: add_labels
      type: Mutator
      api_version: core/v2
    handler:
      name: email
      type: Handler
      api_version: core/v2
{
  "type": "Pipeline",
  "api_version": "core/v2",
  "metadata": {
    "name": "incident_alerts",
    "namespace": "default",
    "created_by": "admin"
  },
  "spec": {
    "workflows": [
      {
        "name": "labeled_email_alerts",
        "filters": [
          {
            "name": "state_change_only",
            "type": "EventFilter",
            "api_version": "core/v2"
          }
        ],
        "mutator": {
          "name": "add_labels",
          "type": "Mutator",
          "api_version": "core/v2"
        },
        "handler": {
          "name": "email",
          "type": "Handler",
          "api_version": "core/v2"
        }
      }
    ]
  }
}

To use pipelines, list them in check definitions in the pipelines array. All the observability events that the check produces will be processed according to the pipeline’s workflows.

Handlers

Handlers are actions the Sensu backend executes on events. Sensu also checks your handlers for the event filters and mutators to apply in the filter and transform stages.

A few different types of handlers are available in Sensu. The most common are pipe handlers, which work similarly to checks and enable Sensu to interact with almost any computer program via standard streams.

Here’s an example resource definition for a pipe handler — read Send Slack alerts with handlers to learn how to configure your own version of this handler:

---
type: Handler
api_version: core/v2
metadata:
  created_by: admin
  name: slack
  namespace: default
spec:
  command: sensu-slack-handler --channel '#monitoring'
  env_vars:
  - SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T0000/B000/XXXXXXXX
  filters: null
  handlers: null
  runtime_assets:
  - sensu-slack-handler
  secrets: null
  timeout: 0
  type: pipe
{
  "type": "Handler",
  "api_version": "core/v2",
  "metadata": {
    "created_by": "admin",
    "name": "slack",
    "namespace": "default"
  },
  "spec": {
    "command": "sensu-slack-handler --channel '#monitoring'",
    "env_vars": [
      "SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T0000/B000/XXXXXXXX"
    ],
    "filters": null,
    "handlers": null,
    "runtime_assets": [
      "sensu-slack-handler"
    ],
    "secrets": null,
    "timeout": 0,
    "type": "pipe"
  }
}

Other types of handlers include Sumo Logic metrics handlers and TCP stream handlers, which provide persistent connections for transmitting Sensu observation data to remote data storage services to help prevent data bottlenecks. Sensu’s Sumo Logic metrics handlers and TCP stream handlers are available for use only in pipelines.

You can also use traditional TCP/UDP handlers to send your observation data to remote sockets and handler sets to streamline groups of actions to execute for certain types of events.

Discover, download, and share Sensu handler dynamic runtime assets in Bonsai, the Sensu asset hub Read Use assets to install plugins to get started.