DEV Community

Cover image for Provisioning Contact Points and Policies in Grafana
Kenta Takeuchi
Kenta Takeuchi

Posted on • Originally published at bmf-tech.com

Provisioning Contact Points and Policies in Grafana

This article was originally published on bmf-tech.com.

Overview

It has become possible to provision Contact Points in Grafana, so I tried setting up provisioning.

Environment

Configuration Method

This is a rough note, so I will omit the explanation around building with Docker Compose. Refer to bmf-san/gobel-example.

Add contact-points.yml and policies.yml under provisioning/alerting. The file names can be arbitrary.

└── provisioning
    └──alerting
            ├── alert-rules.yml
            ├── contact-points.yml
            └── policies.yml
Enter fullscreen mode Exit fullscreen mode

Contact Points

Below is an example configuration for notifying Slack via webhook.

apiVersion: 1

contactPoints:
  - orgId: 1
    name: Slack
    receivers:
      - uid: abc1234
        type: slack
        settings:
          recepient: alert-slack-channel-name
          url: [webhook url]
        disableResolveMessage: false
Enter fullscreen mode Exit fullscreen mode

You can assign any uid when provisioning.

recepient is the Slack notification channel name.

url is set to the webhook url. It can also be configured to use a token.

cf. grafana.com - #provision-contact-points

Policies

Provisioning Policies is also necessary to reflect the settings of provisioned Contact Points and send Alert notifications, otherwise, the default ones will be used. (I didn't investigate if there are other ways.)

Below is an example configuration when creating a Contact Point named Slack.

apiVersion: 1

policies:
  - orgId: 1
    receiver: Slack
Enter fullscreen mode Exit fullscreen mode

receiver specifies the Contact Points name.

The configuration is minimal.

cf. grafana.com - #provision-notification-policies

By provisioning in this way, you can configure alerts to be sent to any Contact Points.

Impressions

It has become easier since I used to configure it manually.

Top comments (0)