Before creating a Slack notifier in Observability Platform, create an incoming webhook in Slack. See
Sending messages using incoming webhooks
in the Slack documentation for more information.
CHANNEL: Deprecated. The Slack channel to send notifications to.
USERNAME: Send the notification message from a specified Slack username.
Enter the URL you created for your webhook in Slack as the value for the api_url
field. The API URL contains the channel to send the message to.
Optional: Enter the Slack username to post the notifier as in the username
field.
Apply the changes:
chronoctl apply -f FILE_NAME.yaml
Replace FILE_NAME with the name of your notifier YAML file.
To create a Slack notifier:
Create a Slack notifier with Terraform by using the
chronosphere_slack_alert_notifier type followed by a name in a resource
declaration:
resource "chronosphere_slack_alert_notifier" "slack_notifier" { name = "Slack Notifier" # Optional slug of the slack notifier. slug = "slack-notifier" ## Notifier-specific required configuration. # For detailed definitions, see # https://prometheus.io/docs/alerting/latest/configuration/#slack_config # `api_url` is a sensitive value. Treat it like a secret. api_url = "https://hooks.slack.com/services/XXXXX/XXXXX/XXXXX" channel = "alerts" ## Notifier-specific optional configurations username = "alertbot" callback_id = "my_callback_id" color = "red" fallback = "my_fallback" footer = "my_footer" icon_emoji = "" image_url = "https://example.com/images/img.png" link_names = false mrkdwn_in = [] pretext = "my_pretext" short_fields = false text = "my_text" title = "my_title" title_link = "my_title_link" # Can have multiple fields. fields { title = "my_title" value = "my_value" short = true } # Optional list of actions action { name = "my_action" style = "my_style" text = "my_text" type = "my_type" url = "my_url" value = "my_value" action_confirm_text = "confirmation text" action_confirm_tile = "confirmation title" action_confirm_ok_text = "confirmation ok text" action_confirm_dismiss_text = "dismissal text" } ## (Optional) Base configuration common to all notifiers send_resolved = true # The default value ## (Optional) HTTP configuration common to HTTP notifiers basic_auth_username = "username" basic_auth_password = "strong+p@ssword" # Can use bearer_token instead of basic auth proxy_url = "https://my-proxy-url" tls_insecure_skip_verify = false}
Enter the URL you created for your webhook in Slack as the
value for the api_url field. The API URL contains the channel to send the message to.
The channel field is deprecated.
Optional: Enter the Slack username to post the notifier as in the username
field.
Run terraform apply to create the notifier resource.
terraform apply
To complete this action with the Chronosphere API, use the slack object in the
CreateNotifier endpoint.Because the Chronosphere API requires authentication, include an API token with your
curl request, as shown in the following example. For more details, see
Create an API token.