Slack

ENTERPRISE: Built-in integrations are available for Sensu Enterprise users only.

Overview

Send notifications to a Slack channel for events. After configuring an incoming webhook in Slack, configure the handler (integration) with the provided webhook url.

Configuration

Example(s)

The following is an example global configuration for the slack enterprise event handler (integration).

{
  "slack": {
    "webhook_url": "https://hooks.slack.com/services/IB6JgRmRJ/eL7Hgo6kF/CckJm8E4Yt8X3i6QRKHWBekc",
    "username": "sensu",
    "channel": "#ops",
    "timeout": 10
  }
}

Integration Specification

slack attributes

The following attributes are configured within the {"slack": {} } configuration scope.

webhook_url
description The Slack incoming webhook URL - https://api.slack.com/incoming-webhooks.
required true
type String
example “webhook_url”: “https://hooks.slack.com/services/IB6JgRmRJ/eL7Hgo6kF/CckJm8E4Yt8X3i6QRKHWBekc"
channel
description The Slack channel to notify.
required false
type String
default #general
example
"channel": "#ops"
username
description The Slack username to use to notify the channel.
required false
type String
default sensu
example
"username": "monitoring"
icon_url
description The Slack icon URL to use for notifications.
required false
type String
default http://www.gravatar.com/avatar/9b37917076cee4e2d331a785f3426640
example
"icon_url": "http://www.gravatar.com/avatar/9b37917076cee4e2d331a785f3426640"
templates
description A set of attributes that configure Slack notification templates configuration.
required false
type Hash
example
"templates": {
  "text": "/etc/sensu/slack/text_template.erb"
}
filters
description An array of Sensu event filters (names) to use when filtering events for the handler. Each array item must be a string. Specified filters are merged with default values.
required false
type Array
default
["handle_when", "check_dependencies"]
example
"filters": ["recurrence", "production"]
severities
description An array of check result severities the handler will handle. NOTE: event resolution bypasses this filtering.
required false
type Array
allowed values ok, warning, critical, unknown
default
["warning", "critical", "unknown"]
example
 "severities": ["critical", "unknown"]
timeout
description The handler execution duration timeout in seconds (hard stop).
required false
type Integer
default 10
example
"timeout": 30

templates attributes

The following attributes are configured within the {"slack": { "templates": {} } } configuration scope.

text
description Path to the Slack attachment text ERB template file, which must be accessible by the sensu system user. If an attachment text subject template is not provided, a built-in default template will be used.
required false
type String
example
"text": "/etc/sensu/slack/text_template.erb"