From cac8ae44852960d2011c39a8cb5e62afd0ae7763 Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Thu, 17 May 2018 10:21:07 +0200 Subject: [PATCH 1/2] alerting: update Slack configuration Signed-off-by: Simon Pasquier --- content/docs/alerting/configuration.md | 39 +++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/content/docs/alerting/configuration.md b/content/docs/alerting/configuration.md index 20a93849a..78b3167cc 100755 --- a/content/docs/alerting/configuration.md +++ b/content/docs/alerting/configuration.md @@ -436,7 +436,9 @@ token: ## `` -Slack notifications are sent via [Slack webhooks](https://api.slack.com/incoming-webhooks). +Slack notifications are sent via [Slack +webhooks](https://api.slack.com/incoming-webhooks). The notification contains +an [attachment](https://api.slack.com/docs/message-attachments). ```yaml # Whether or not to notify about resolved alerts. @@ -449,20 +451,49 @@ Slack notifications are sent via [Slack webhooks](https://api.slack.com/incoming channel: # API request data as defined by the Slack webhook API. -[ color: | default = '{{ if eq .Status "firing" }}danger{{ else }}good{{ end }}' ] +[ icon_emoji: ] +[ icon_url: ] +[ link_names: | default = false ] [ username: | default = '{{ template "slack.default.username" . }}' ] +# The following parameters define the attachment. +[ color: | default = '{{ if eq .Status "firing" }}danger{{ else }}good{{ end }}' ] [ title: | default = '{{ template "slack.default.title" . }}' ] [ title_link: | default = '{{ template "slack.default.titlelink" . }}' ] -[ icon_emoji: ] -[ icon_url: ] [ pretext: | default = '{{ template "slack.default.pretext" . }}' ] [ text: | default = '{{ template "slack.default.text" . }}' ] [ fallback: | default = '{{ template "slack.default.fallback" . }}' ] +[ footer: | default = '{{ template "slack.default.footer" . }}' ] +fields: + [ ... ] +actions: + [ ... ] +[ short_fields: | default = false ] # The HTTP client's configuration. [ http_config: | default = global.http_config ] ``` +### `` + +The fields are documented in the [Slack API documentation](https://api.slack.com/docs/message-attachments#action_fields). + +```yaml +type: +text: +url: +[ style: [ default = '' ] +``` + +### `` + +The fields are documented in the [Slack API documentation](https://api.slack.com/docs/message-attachments#fields). + +```yaml +title: +value: +[ short: | default = slack_config.short_fields ] +``` + ## `` OpsGenie notifications are sent via the [OpsGenie API](https://www.opsgenie.com/docs/web-api/alert-api). From 1508b090c8212486701a625b3c4d431a218c5624 Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Fri, 18 May 2018 14:15:41 +0200 Subject: [PATCH 2/2] alerting: re-order Slack parameters Signed-off-by: Simon Pasquier --- content/docs/alerting/configuration.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/content/docs/alerting/configuration.md b/content/docs/alerting/configuration.md index 78b3167cc..40a0e8784 100755 --- a/content/docs/alerting/configuration.md +++ b/content/docs/alerting/configuration.md @@ -456,18 +456,18 @@ channel: [ link_names: | default = false ] [ username: | default = '{{ template "slack.default.username" . }}' ] # The following parameters define the attachment. +actions: + [ ... ] [ color: | default = '{{ if eq .Status "firing" }}danger{{ else }}good{{ end }}' ] -[ title: | default = '{{ template "slack.default.title" . }}' ] -[ title_link: | default = '{{ template "slack.default.titlelink" . }}' ] -[ pretext: | default = '{{ template "slack.default.pretext" . }}' ] -[ text: | default = '{{ template "slack.default.text" . }}' ] [ fallback: | default = '{{ template "slack.default.fallback" . }}' ] -[ footer: | default = '{{ template "slack.default.footer" . }}' ] fields: [ ... ] -actions: - [ ... ] +[ footer: | default = '{{ template "slack.default.footer" . }}' ] +[ pretext: | default = '{{ template "slack.default.pretext" . }}' ] [ short_fields: | default = false ] +[ text: | default = '{{ template "slack.default.text" . }}' ] +[ title: | default = '{{ template "slack.default.title" . }}' ] +[ title_link: | default = '{{ template "slack.default.titlelink" . }}' ] # The HTTP client's configuration. [ http_config: | default = global.http_config ]