Grafana: Notification Policies

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

Checked on 2026-11-09 against Grafana 13.3.x. Tested with Grafana Enterprise 13.3.0 in the hands-on lab: the lab’s smaller policy tree loads from a provisioning file, a critical alert reached the webhook receiver about 10 seconds after the group wait of its policy, and resolved notifications of the warning policy waited for its 5 minute group interval; the HCL passes terraform validate apart from the contact points it refers to.

To do this by hand, follow Send Notifications.

An alert instance that fires is only an input. Between it and a person sits the decision of who is told, how many messages that takes and how often they are repeated. In Grafana that decision lives in the notification policy tree: a set of rules that match the labels of an instance, group matching instances into one notification and hand the notification to a contact point. Everything the tree can do depends on the labels the rules carry (see Labels, Annotations and Rule Templates), and what the contact point does with the message is on Contact Points and Integrations and Notification Templates. Where the tree sits in the Alertmanager that Grafana embeds is covered in Alerting Architecture; the general routing and grouping model is in Alerting Fundamentals, and the design guidance (severity, ownership) in Designing Actionable Alerts. The Prometheus equivalent is Alertmanager. The running example is the Bookshelf service (see Metrics and Observability) with the five alerts of the Hands-on Lab.

The routing tree

The root of the tree is the Default notification policy. Every policy can have child policies and siblings, and Grafana uses one tree by default. The Default policy matches every alert, so an alert that no other policy matches is still handled by it and nothing is lost.

Matching starts at the Default policy and goes down:

  1. Grafana looks at the children of the Default policy from top to bottom for a policy whose matchers all match the labels of the instance.

  2. When one matches, Grafana looks at that policy’s children, and so on, until no deeper policy matches. Only the deepest matching policy handles the instance.

  3. By default the search stops at the first matching policy and its siblings are not checked. Enabling Continue matching subsequent sibling nodes on a policy lets later siblings handle the same instance too, so one alert can reach several contact points.

Each policy has label matchers: a label name, an operator and a value. The operators are = (equal), != (not equal), =~ (matches the regular expression) and !~ (does not match). Several matchers on one policy are combined with AND, all must match. An instance needs the labels the policy asks for; extra labels do no harm. To match the absence of a label, for example "no team label", the page gives three equivalent forms for team: = with an empty value, !~ with .+, or =~ with ^$.

The page illustrates routing with three cases. An alert that has only team=operations matches the operations policy and none of its children. An alert that has team=operations and a severity label matches the more specific severity child. An alert with team=security skips the operations policy, matches the security policy and ignores the extra severity=high label because that policy has no children.

Inheritance and overrides

A child policy inherits the contact point, the grouping options and the timing options of its parent unless it sets its own. That is why the children of the operations policy in the example do not need a contact point of their own. Nesting is the way to route by team first and then by a narrower label while sharing settings: the team policy holds what the team has in common and the children override only the difference.

Grouping

By default Grafana groups by alert rule, using the alertname and grafana_folder labels. The folder label is part of the default because rule names are not unique across folders. Instances end up in the same group only when their values are exactly equal for every label in Group by. With Group by set to team, two alerts with different names but team=frontend form one group, and an alert with team=backend forms another.

Two special settings change that. Leaving Group by empty in the Default policy puts all alerts that the policy handles in one group. Grouping by the special label ... turns grouping off: every alert is its own notification, as long as no other label is listed. That suits a very low alert volume, or an upstream system that groups by itself, and little else.

The three timers

Timer Default Meaning

Group wait

30 seconds

Time to wait before the first notification of a new group, so related alerts can join. Alerts that resolve before the timer elapses produce no notification, which cuts the noise of flapping alerts.

Group interval

5 minutes

Time to wait before notifying about changes to an existing group (a new firing alert joins, or one resolves). The timer starts after the first notification; when it elapses a notification is sent only if the group changed. Resolved alerts leave the group once the change is notified, and when no alerts remain the group is deleted and group wait starts again with the next alert.

Repeat interval

4 hours

Time before a notification for an unchanged group is sent again, as a reminder that alerts are still firing. It is evaluated each time the group interval resets.

The repeat interval has constraints: it must be greater than or equal to the group interval and a multiple of it (otherwise Grafana rounds it up, so a 9 minute repeat interval with a 5 minute group interval becomes 10 minutes), and its maximum is 5 days, bounded by the default notification_log_retention setting.

The practical effect for Bookshelf: with the defaults, a 5xx breach that starts at minute 0 and is noticed by the rule after its pending period produces the first webhook about 30 seconds after the instance enters Alerting, a second one only if the group changes within the next five minutes (for example the p95 latency alert joins the same group), and a reminder every four hours. A lower group wait gives faster pages and risks splitting a burst into two messages; a higher one groups better and delays the page. Choose per severity: seconds for critical, minutes for the rest.

Source: Grafana: Group alert notifications (timing options and repeat interval constraints).

A Bookshelf routing tree

The metadata contract of the lab rules (team, application, severity, see Designing Actionable Alerts) maps onto a small tree. Critical alerts of the bookshelf-sre team page the on-call contact point, warnings open a ticket, informational alerts go to chat, the platform team gets its own branch, and the alerts that Grafana generates for missing data and query errors have their own policy because they do not carry the labels of the rule. Everything else falls to the Default policy, whose contact point is the chat channel, so that nothing is lost.

This is the fuller design. The lab itself provisions a smaller tree (Default, then team = bookshelf-sre, then severity = critical and severity = warning, all sending to the one contact point bookshelf-webhook; see Provisioning Alerting Resources). To try the tree below, create bookshelf-oncall, bookshelf-tickets, bookshelf-chat and platform-oncall as webhook contact points that post to http://webhook-receiver:8080/grafana and apply the file below in place of the lab’s policy tree.

flowchart TD D["Default policy: group by alertname and grafana_folder, contact point bookshelf-chat"] D --> ND["alertname =~ DatasourceNoData or DatasourceError: contact point platform-oncall"] D --> TC["team = bookshelf-sre: inherits Default"] D --> TP["team = platform: contact point platform-oncall"] TC --> C["severity = critical: contact point bookshelf-oncall, group wait 10s, repeat 1h"] TC --> W["severity = warning: contact point bookshelf-tickets"] TC --> I["severity = info: contact point bookshelf-chat, repeat 12h"]

The first rule of the design is that the order of siblings matters: policies are evaluated from top to bottom and the first match wins unless Continue matching subsequent sibling nodes is set. The second rule is to keep the severity vocabulary small and fixed, because every value you route on must exist as a policy and every typo falls through to the parent. A Bookshelf alert with severity=critcal is handled by the team=bookshelf-sre policy and, since that policy has no contact point of its own, by the Default policy’s contact point.

The four contact points of the tree are webhook contact points (in the lab all post to different paths of the same receiver); see Contact Points and Integrations for creating them.

In the UI

Open Alerts & IRM, Alerting, Notification configuration, then the Notification policies tab. The Choose Alertmanager dropdown defaults to the Grafana Alertmanager.

Edit the Default policy. In the Default policy section open the menu and select Edit. Set the Default contact point, the Group by labels and the Timing options (group wait, group interval, repeat interval), then Save. The root policy does not support mute timings or active time intervals; add them to child policies.

Add a child policy. Click +New child policy under the Default policy or under an existing policy and fill in:

  • Matching labels: one or more matcher rules that narrow the parent’s scope, for example team=bookshelf-sre.

  • Contact point: the destination; if left empty the parent’s contact point is inherited.

  • Continue matching subsequent sibling nodes: lets the alert also match later siblings.

  • Override grouping: when disabled the parent’s grouping is inherited.

  • Override general timings: when disabled the parent’s timing options are inherited.

  • Mute timings and Active timings: optional time intervals for this policy, not available on the root policy and not inherited. A mute timing pauses notifications during a recurring period; an active time interval allows them only during one. They are created on a separate page (see Silences, Mute Timings and Inhibition).

  • Click Save policy.

Add a sibling. On the policy that should sit beside the new one, use Add new policy and then New sibling above or New sibling below. Set the order carefully, because policies are evaluated top to bottom and the children of a matching policy are then evaluated in display order.

Search. Select a contact point to highlight the policies that use it, or enter a matcher (several matchers separated by a comma). Searches are exact matches only: regular expressions work in matchers but not in the search, and partial matches are not supported. The Default policy cannot be deleted, but it can be reset to clear it.

As a file

The whole tree is one resource: sub-policies go under the root policy, subsets of the tree cannot be provisioned, and provisioning overwrites all policies of the tree (it does not touch the internal policies that Grafana creates when a rule selects a contact point directly). The file below defines the tree of the diagram. The contact points named here must exist (they can be provisioned in the same directory, see Provisioning Alerting Resources). The matchers use the Grafana-style object_matchers form; matchers accepts the Prometheus-style strings instead.

# provisioning/alerting/bookshelf-policies.yaml
apiVersion: 1
policies:
  - orgId: 1
    receiver: bookshelf-chat
    group_by: ['alertname', 'grafana_folder']
    group_wait: 30s
    group_interval: 5m
    repeat_interval: 4h
    routes:
      - receiver: platform-oncall
        object_matchers:
          - ['alertname', '=~', 'DatasourceNoData|DatasourceError']
      - object_matchers:
          - ['team', '=', 'bookshelf-sre']
        routes:
          - receiver: bookshelf-oncall
            object_matchers:
              - ['severity', '=', 'critical']
            group_wait: 10s
            repeat_interval: 1h
          - receiver: bookshelf-tickets
            object_matchers:
              - ['severity', '=', 'warning']
          - receiver: bookshelf-chat
            object_matchers:
              - ['severity', '=', 'info']
            repeat_interval: 12h
      - receiver: platform-oncall
        object_matchers:
          - ['team', '=', 'platform']

Reference: Grafana: Provision notification policies with files. To reset the tree to its default list the organisation id under resetPolicies.

As Terraform

The grafana_notification_policy resource manages the entire tree and overwrites its policies; it does not overwrite the internal policies created when rules choose a contact point directly. Nested policy blocks can omit contact_point and timing options to inherit them from the parent. active_timings requires Grafana 12.1 or later.

resource "grafana_notification_policy" "bookshelf" {
  contact_point   = grafana_contact_point.bookshelf_chat.name
  group_by        = ["alertname", "grafana_folder"]
  group_wait      = "30s"
  group_interval  = "5m"
  repeat_interval = "4h"

  policy {
    matcher {
      label = "alertname"
      match = "=~"
      value = "DatasourceNoData|DatasourceError"
    }
    contact_point = grafana_contact_point.platform_oncall.name
  }

  policy {
    matcher {
      label = "team"
      match = "="
      value = "bookshelf-sre"
    }

    policy {
      matcher {
        label = "severity"
        match = "="
        value = "critical"
      }
      contact_point   = grafana_contact_point.bookshelf_oncall.name
      group_wait      = "10s"
      repeat_interval = "1h"
    }

    policy {
      matcher {
        label = "severity"
        match = "="
        value = "warning"
      }
      contact_point = grafana_contact_point.bookshelf_tickets.name
    }

    policy {
      matcher {
        label = "severity"
        match = "="
        value = "info"
      }
      contact_point   = grafana_contact_point.bookshelf_chat.name
      repeat_interval = "12h"
    }
  }

  policy {
    matcher {
      label = "team"
      match = "="
      value = "platform"
    }
    contact_point = grafana_contact_point.platform_oncall.name
  }
}

Reference: Terraform: grafana_notification_policy. The provisioning HTTP API for the same tree is PUT /api/v1/provisioning/policies; adding the header X-Disable-Provenance: true allows editing the provisioned resource in the UI (see Grafana: Provision alerting resources with the HTTP API).

Several trees

The page about policies states that Grafana uses one tree by default and that you can create more, each with its own name, root policy and child policies, to organise routing by team, service or domain. In Terraform the resource for an additional tree is grafana_apps_notifications_routingtree_v1beta1 (its name carries the API version v1beta1), and a rule opts in by setting notification_settings.policy to the tree’s metadata.uid; rules that do not set it keep using the default tree.

Source: Grafana: Provision with Terraform ("Enable multiple notification policy trees").

A contact point in the rule, or the tree

Each rule decides under Configure notifications how its notifications are routed:

  • Default (select a contact point): all notifications for the rule go to that contact point and the notification policies are not used. Grafana creates internal policies for such rules, which is why provisioning the tree does not remove them. Additional settings such as grouping and timing can be set on the rule.

  • Advanced (use notification policies): the notification policy tree handles the rule by its labels. Preview routing, once the earlier parts of the form are filled in, shows which policies would handle the notifications, and View route shows the details. You can switch between the two at any time.

A rule that names its contact point is simple and visible next to the rule, which suits a handful of rules and a single owner. It does not scale: changing an escalation means editing every rule, and severity cannot be routed centrally. A tree keeps routing in one place that the on-call team owns, which is why the lab alerts use it.

Source: Grafana: Configure Grafana-managed alert rules ("Configure notifications") and Grafana: Provision with files (internal policies).

What can go wrong

  • Everything lands in the Default contact point. A matcher spelling or case differs from the label (Severity against severity), or the label is on the rule but a template renders an empty value. Use Preview routing.

  • A branch never receives alerts. A sibling above it matches first and Continue matching subsequent sibling nodes is off.

  • No page for missing data. The DatasourceNoData and DatasourceError alerts do not carry all labels of the rule, so a team or severity matcher does not match them; they need a policy on alertname (the tree above has one).

  • Timers rejected or rounded. A repeat interval that is not a multiple of the group interval is rounded up; one below the group interval is not valid; the maximum is 5 days.

  • A mute timing is configured on the root. The root policy does not support mute timings or active time intervals; put them on a child policy, and create the complementary policy that handles the other hours, otherwise you will simply not be notified during the muted period.

  • Provisioned tree replaced. Provisioning a tree from a file or Terraform overwrites all policies of the tree, so a policy added by hand in the UI is not kept.

  • Group by lists a label that varies. A label with many values (an instance, a request id) splits what should be one notification into many; group by ... does the same on purpose.

  • Instances split by a changing label. A templated label that follows a value creates new instances and new notifications (see Labels, Annotations and Rule Templates).

Verify it in the lab

With the grafana profile running (see Hands-on Lab), the four webhook contact points created and the tree above applied:

  1. Open the Notification policies tab and confirm the Default policy shows alertname and grafana_folder as Group by and the timers 30s, 5m and 4h. Search for bookshelf-oncall and see the critical policy highlighted.

  2. Edit the rule Bookshelf high 5xx ratio and use Preview routing with team: bookshelf-sre and severity: critical: the matching policy must be the critical child. Change the label to severity: critcal and see the preview fall back to the team=bookshelf-sre policy and its inherited contact point.

  3. Switch on the load generator’s failing-request mode and measure the time from the instance entering Alerting to the webhook arriving at the receiver: it should be close to the group wait of the critical policy (10 seconds) rather than the default 30 seconds.

  4. Trigger the no-data alert (stop the Bookshelf container) and confirm that the notification goes to platform-oncall, because it is routed on alertname.

  5. Fire two alerts of the same folder at once and see one notification (grouped by alertname and grafana_folder gives one message per rule; change Group by on the Default policy to team to see them merge).

  6. Turn on Continue matching subsequent sibling nodes on the team=bookshelf-sre policy, add a sibling for application=bookshelf below it with the contact point bookshelf-tickets, and check that both contact points receive the alert.

In the books

Salituro’s chapter 12 (Grafana 10) uses the same pattern as the tree above: a severity label set when the rule is created, a Default policy that sends everything to one contact point for archival, and policies that match the severity to PagerDuty, Slack or email, plus Group by and timing options. McCollam’s chapter 11 shows a notification policy combined with a mute timing for weekends and warns that you then need another policy for the hours that are muted. Hernandez’s chapter 10 describes grouping policies and adding them in the Grafana 8 era. The concepts are unchanged. What the books predate is the folder label in the default grouping, active time intervals, the explicit repeat interval rules, multiple policy trees, and the Default and Advanced routing choice in the rule form.