- Watcher Reference for 2.x and 1.x:
- Introduction
- Getting Started
- Customizing Watches
- How Watcher Works
- Installing Watcher
- Administering Watcher
- Configuring Watcher to Send Email
- Configuring Watcher to Send Messages to HipChat
- Configuring Watcher to Send Messages to Slack
- Configuring Watcher to Send PagerDuty Events
- Integrating Watcher with Shield
- Integrating Watcher with Logstash
- Configuring the Default Throttle Period
- Configuring the Default HTTP Timeouts
- Configuring the Default Internal Operations Timeouts
- Getting Watcher Statistics
- Monitoring Watch Execution
- Managing Watches
- Example Watches
- Reference
- Managing Your License
- Limitations
- Troubleshooting
- Release Notes
Configuring Watcher to Send Messages to Slack
editConfiguring Watcher to Send Messages to Slack
editYou can configure Watcher to send messages to Slack channels and users.
Configuring Slack Accounts
editYou configure the accounts Watcher can use to communicate with Slack in your elasticsearch.yml
configuration file. Each account configuration has a unique name and specifies an
Incoming Webhook
URL for posting messages to Slack. You can also specify message defaults,
such the sender name and icon.
Before you can configure a Slack account, you need to set up an Incoming Webhook Integration through the Slack console:
- Log in to slack.com as a team administrator.
- Go to https://my.slack.com/services/new/incoming-webhook/.
-
Select a default channel for the integration.
- Click Add Incoming Webhook Integration.
-
Copy the generated webhook URL so you can paste it into your Slack account configuration in
elasticsearch.yml
.
To configure a Slack account in Watcher, you set the watcher.actions.slack.service
property in
elasticsearch.yml
. You must set the url
to your incoming webhook integration URL.
You can also specify defaults for the notification messages. For the complete list of attributes,
see Slack Account Attributes.
For example, the following snippet configures an account called notify-monitoring
and sets the
default sender name to Watcher
.
watcher.actions.slack.service: account: monitoring: url: https://hooks.slack.com/services/T00000000/B00000001/XXXXXXXXXXXXXXXXXXXXXXXX message_defaults: from: Watcher
If you configure multiple Slack accounts, you either need to configure a default Slack account
or specify which account the notification should be sent with in the slack
action. You set default_account
in watcher.actions.slack.service
to specify a default account.
watcher.actions.slack.service: default_account: team1 account: team1: url: https://hooks.slack.com/services/T00000000/B00000001/XXXXXXXXXXXXXXXXXXXXXXXX message_defaults: from: watcher team2: url: https://hooks.slack.com/services/T00000000/B00000002/XXXXXXXXXXXXXXXXXXXXXXXX message_defaults: from: watcher
Slack Account Attributes
editName |
Required |
Description |
|
yes |
The Incoming Webhook URL to use to post messages to Slack. |
|
no |
The sender name to display in the Slack message. Defaults to the watch ID. |
`message_defaults.to ` |
no |
The default Slack channels or groups you want to send messages to. |
|
no |
The icon to display in the Slack messages. Overrides the incoming webhook’s configured icon. Accepts a public URL to an image. |
|
no |
The default message content. |
|
no |
Default message attachments. Slack message attachments enable you to create more richly-formatted messages. Specified as an array as defined in the Slack attachments documentation. |