Skip to content

Alert Manager

Lyes S edited this page May 21, 2022 · 6 revisions

Table Of Contents

Configuration

Please refer to the official documentation for more information : Alertmanager | Prometheus

global:

  resolve_timeout: 1m

  # The API URL to use for Slack notifications (WebHook URL).
  # Refer to the screenshot : https://raw.githubusercontent.com/wiki/lyes-s/network-device-inventory/images/integration-settings.PNG
  slack_api_url: <ADD_YOUR_SLACK_API_URL>


# The root node of the routing tree.
route:
  receiver: 'slack-notifications'

# A list of notification receivers.
receivers:
  - name: 'slack-notifications'
    slack_configs:
      - channel: '#prometheus-alerts'
        send_resolved: true
        icon_url: https://avatars3.githubusercontent.com/u/3380462
        title: |-
          [{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .CommonLabels.alertname }} for {{ .CommonLabels.job }}
          {{- if gt (len .CommonLabels) (len .GroupLabels) -}}
            {{" "}}(
            {{- with .CommonLabels.Remove .GroupLabels.Names }}
              {{- range $index, $label := .SortedPairs -}}
                {{ if $index }}, {{ end }}
                {{- $label.Name }}="{{ $label.Value -}}"
              {{- end }}
            {{- end -}}
            )
          {{- end }}
        text: >-
          {{ range .Alerts -}}
          *Alert:* {{ .Annotations.title }}{{ if .Labels.severity }} - `{{ .Labels.severity }}`{{ end }}
          
          *Description:* {{ .Annotations.description }}
          
          *Details:*
            {{ range .Labels.SortedPairs }} β€’ *{{ .Name }}:* `{{ .Value }}`
            {{ end }}
          {{ end }}
Clone this wiki locally