Sensu Plus

COMMERCIAL FEATURE: Access Sensu Plus in the packaged Sensu Go distribution. For more information, read Get started with commercial features.

Sensu Plus is a built-in integration for transmitting your Sensu observability data to the Sumo Logic Continuous Intelligence Platform™ via a Sumo Logic HTTP Logs and Metrics Source. In Sumo Logic, you can configure customized interactive dashboards and analytics tools to gain better visibility into your Sensu data — read Introducing Sensu Plus for more information.

To use Sensu Plus, you need a Sumo Logic account. First, create a new Sumo Logic account or log in to your existing account. Then, follow this guide to set up an HTTP Logs and Metrics Source; configure a Sensu handler, pipeline, and check; and import two dashboards as a starting point for visualizing your Sensu data in Sumo Logic.

Set up an HTTP Logs and Metrics Source

Set up a Sumo Logic HTTP Logs and Metrics Source to collect your Sensu observability data:

  1. In the Sumo Logic left-navigation menu, click Manage Data and then Collection.

    Open the Collections tab
  2. At the top-right of the Collection tab, click Add Collector.

    Add a Sumo Logic collector
  3. In the Click Selector Type modal window, click Hosted Collector.

    Select the hosted collector option
  4. In the Add Hosted Collector modal window:

    • Type sensu in the Name field.
    • Click Save.
    Name the hosted collector
  5. In the Confirm prompt, click OK.

    Confirm your hosted collector configuration
  6. Under Cloud APIs, click HTTP Logs & Metrics.

    Select the HTTP Logs & Metrics source
  7. In the HTTP Logs & Metrics form:

    • Type sensu-http in the Name field.
    • Type sensu-events in the Source Category field.
    • Click Save.
    Select options for HTTP Logs & Metrics source
  8. In the HTTP Source Address prompt, copy the listed URL and click OK. You will use this URL as the value for the url attribute in your Sensu handler definition.

    Retrieve the HTTP Source Address URL

Create a handler in Sensu

To send your Sensu observability data to your new Sumo Logic HTTP Logs and Metrics Source, create a Sumo Logic metrics handler. Sumo Logic metrics handlers provide a persistent connection to transmit Sensu observability data, which helps prevent the data bottlenecks you may experience with traditional handlers.

NOTE: Sumo Logic metrics handlers only accept metrics events. To send status events, use the Sensu Sumo Logic Handler integration instead.

For a Sumo Logic metrics handler, the resource definition must use the URL you copied in the last step of setting up your HTTP Logs and Metrics Source as the value for the url attribute.

Here is an example Sumo Logic Metrics Handler definition. Before you run the command to add this handler, replace the url example value with the URL for your Sumo Logic HTTP Logs and Metrics Source:

cat << EOF | sensuctl create
---
type: SumoLogicMetricsHandler
api_version: pipeline/v1
metadata:
  name: sumo_logic_http_metrics
spec:
  url: "https://collectors.sumologic.com/receiver/v1/http/xxxxxxxx"
  max_connections: 10
  timeout: 10s
EOF
cat << EOF | sensuctl create
{
  "type": "SumoLogicMetricsHandler",
  "api_version": "pipeline/v1",
  "metadata": {
    "name": "sumo_logic_http_metrics"
  },
  "spec": {
    "url": "https://collectors.sumologic.com/receiver/v1/http/xxxxxxxx",
    "max_connections": 10,
    "timeout": "10s"
  }
}
EOF

If you prefer, you can configure your Sumo Logic HTTP Logs and Metrics Source URL as a secret with Sensu’s env secrets provider to avoid exposing the URL in your handler definition. This example shows the same definition with the URL referenced as a secret instead:

cat << EOF | sensuctl create
---
type: SumoLogicMetricsHandler
api_version: pipeline/v1
metadata:
  name: sumo_logic_http_metrics
spec:
  url: $SUMO_LOGIC_SOURCE_URL
  secrets:
  - name: SUMO_LOGIC_SOURCE_URL
    secret: sumologic_metrics_us1
  max_connections: 10
  timeout: 10s
EOF
cat << EOF | sensuctl create
{
  "type": "SumoLogicMetricsHandler",
  "api_version": "pipeline/v1",
  "metadata": {
    "name": "sumo_logic_http_metrics"
  },
  "spec": {
    "url": "$SUMO_LOGIC_SOURCE_URL",
    "secrets": [
      {
        "name": "SUMO_LOGIC_SOURCE_URL",
        "secret": "sumologic_metrics_us1"
      }
    ],
    "max_connections": 10,
    "timeout": "10s"
  }
}
EOF

Configure a pipeline

With your handler definition configured, you’re ready to create a pipeline with a workflow that references your sumo_logic_http_metrics handler.

NOTE: Sensu pipelines use event filters, mutators, and handlers as the building blocks for event processing workflows. Read the pipelines reference for detailed information about pipelines.

To configure event processing via your sumo_logic_http_metrics handler, add this example pipeline definition. This pipeline includes a workflow with your sumo_logic_http_metrics handler, along with Sensu’s built-in has_metrics event filter to ensure that the workflow only processes events that contain metrics:

cat << EOF | sensuctl create
---
type: Pipeline
api_version: core/v2
metadata:
  name: sensu_to_sumo
spec:
  workflows:
  - name: metrics_to_sumologic
    filters:
    - name: has_metrics
      type: EventFilter
      api_version: core/v2
    handler:
      name: sumo_logic_http_metrics
      type: SumoLogicMetricsHandler
      api_version: pipeline/v1
EOF
cat << EOF | sensuctl create
{
  "type": "Pipeline",
  "api_version": "core/v2",
  "metadata": {
    "name": "sensu_to_sumo"
  },
  "spec": {
    "workflows": [
      {
        "name": "metrics_to_sumologic",
        "filters": [
          {
            "name": "has_metrics",
            "type": "EventFilter",
            "api_version": "core/v2"
          }
        ],
        "handler": {
          "name": "sumo_logic_http_metrics",
          "type": "SumoLogicMetricsHandler",
          "api_version": "pipeline/v1"
        }
      }
    ]
  }
}
EOF

Add a Sensu check

Your pipeline resource is now properly configured, but it’s not processing any events because no Sensu checks are sending events to it. To get your Sensu observability data flowing through the new pipeline, add the pipeline by reference in at least one check definition.

This example check definition uses the sensu/system-check dynamic runtime asset.

NOTE: Dynamic runtime assets are shareable, reusable packages that make it easier to deploy Sensu plugins. Read the assets reference for more information about dynamic runtime assets.

Follow these steps to configure the required system check:

  1. Add the sensu/system-check dynamic runtime asset:

    sensuctl asset add sensu/system-check:0.1.1 -r system-check

  2. Update at least one Sensu entity to use the system subscription. In the following command, replace <ENTITY_NAME> with the name of the entity on your system. Then, run:

    sensuctl entity update <ENTITY_NAME>

    • For Entity Class, press enter.
    • For Subscriptions, type system and press enter.
  3. Add the following check definition:

    cat << EOF | sensuctl create
    ---
    type: CheckConfig
    api_version: core/v2
    metadata:
      name: system-check
    spec:
      command: system-check
      runtime_assets:
      - system-check
      subscriptions:
      - system
      interval: 10
      timeout: 5
      publish: true
      pipelines:
      - type: Pipeline
        api_version: core/v2
        name: sensu_to_sumo
      output_metric_format: prometheus_text
      output_metric_tags:
      - name: entity
        value: "{{ .name }}"
      - name: namespace
        value: "{{ .namespace }}"
      - name: os
        value: "{{ .system.os }}"
      - name: platform
        value: "{{ .system.platform }}"
    EOF
    cat << EOF | sensuctl create
    {
      "type": "CheckConfig",
      "api_version": "core/v2",
      "metadata": {
        "name": "system-check"
      },
      "spec": {
        "command": "system-check",
        "runtime_assets": [
          "system-check"
        ],
        "subscriptions": [
          "system"
        ],
        "interval": 10,
        "timeout": 5,
        "publish": true,
        "pipelines": [
          {
            "type": "Pipeline",
            "api_version": "core/v2",
            "name": "sensu_to_sumo"
          }
        ],
        "output_metric_format": "prometheus_text",
        "output_metric_tags": [
          {
            "name": "entity",
            "value": "{{ .name }}"
          },
          {
            "name": "namespace",
            "value": "{{ .namespace }}"
          },
          {
            "name": "os",
            "value": "{{ .system.os }}"
          },
          {
            "name": "platform",
            "value": "{{ .system.platform }}"
          }
        ]
      }
    }
    EOF

This check will collect baseline system metrics in Prometheus format for all entities that include the system subscription and send the events to Sumo Logic via your sensu_to_sumo pipeline resource.

NOTE: Sumo Logic metrics handlers only accept metrics events, so you must use a check that produces metrics. If your check produces status events, use the Sensu Sumo Logic Handler integration to create a traditional Sensu handler rather than the Sumo Logic metrics handler.

Import Sumo Logic dashboards

To view your Sensu observability data in Sumo Logic, you can configure Sumo Logic dashboards in any way you wish. As a starting point, follow these instructions to import two dashboards, Sensu Overview and Sensu Entity Details:

  1. On your Sumo Logic home page, click the Personal tab in the left-navigation menu. Click the options icon for the folder where you want to import your Sensu data and select Import.

    Navigate to the folder where you want to import Sensu data
  2. In the Import Content modal window:

    Import Content modal window for dashboards
  3. Scroll to the bottom of the Import Content modal window and click Import. The two new dashboards will be listed in the Sensu folder in the left-navigation menu:

    Sensu Overview and Sensu Entity Details dashboards listed in the Sumo Logic left-navigation menu

    Click a dashboard name to view your Sensu observability data.

It may take a few moments for your data to appear in Sumo Logic. The Sensu Overview and Sensu Entity Details dashboards will begin to display your data:

Data beginning to populate in the Sensu Entity Details dashboard in Sumo Logic