KOP Recipes - Slack - Rafay Product Documentation

Slack

Although a turnkey integration is available for email based notifications, organizations may wish to send notifications to other platforms in use internally. This recipe documents how organizations can customize the "Alert Manager" system addon configuration and send the alerts to Slack.


Configure Slack

If you want to receive the notifications via Slack, you will need an existing Slack workspace or create a new one for testing here.

To setup the alerting to your Slack workspace, you will need a Slack API URL.


Configure Alert Manager Addon

Follow the below steps to create a customized "Alert Manager" System Addon to send notifications to the Slack channel from the prior step.

global:
  resolve_timeout: 5m
  slack_api_url: https://hooks.slack.com/services/T01D6D4xxxxxxxxlhvzNg
receivers:
- name: default-receiver
- name: rafay-webhook
  webhook_configs:
  - http_config:
      tls_config:
        ca_file: /etc/config/certs/ca.crt
        cert_file: /etc/config/certs/client.crt
        insecure_skip_verify: true
        key_file: /etc/config/certs/client.key
        server_name: '{{{ .V2EventFrameworkFQDN }}}'
    url: https://{{{ .V2EventFrameworkFQDN }}}/event/v1/alert/raise
- name: myalerts
  slack_configs:
  - channel: '#alert'
    send_resolved: true
    title_link: nil
- name: myalerts
  slack_configs:
  - channel: '#alert'
    send_resolved: true
    text: |-
      {{ range .Alerts -}}
      *Alert:* {{ .Annotations.title }}{{ if .Labels.severity }} - `{{ .Labels.severity }}`{{ end }}
      *Description:* {{ .Annotations.description }}
      *Details:*
        {{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
        {{ end }}
      {{ end }}
    title: |-
      [{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .CommonLabels.alertname }} for {{ .CommonLabels.job }}
      {{- if gt (len .CommonLabels) (len .GroupLabels) -}}
        {{