Grafana Guide: Send Notifications

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-11 against Grafana 13.3.x.

What you build

You send the alert of the rule Guide high 5xx ratio to the webhook receiver of the lab through your own resources: a contact point guide-webhook that posts to the path /guide, a notification template group guide that formats the title and the message, and a new notification policy tree guide-tree whose route for team = bookshelf-guides uses its own grouping and timings. You finish by forcing a failure and reading the payload that reaches the receiver.

The Notification policies tab at the end of the guide: below the provisioned Default policy the tree guide-tree sends to guide-webhook and has the child route team equals bookshelf-guides, grouped by alertname, with wait 10s, update 1m and repeat 1h

Before you start

  • Start the Grafana profile of the hands-on lab and wait about a minute:

    cd lab
    docker compose --profile grafana up -d
  • Open http://localhost:3000, sign in as admin with the password admin, and click Skip when Grafana 13.3 asks you to update the default password.

  • Do the previous guide, Create an alert rule. It creates the rule Guide high 5xx ratio in the folder Guides with the label team = bookshelf-guides, which the route of this guide matches. If your rule carries other labels, use those in the matcher.

  • The lab provisions a contact point, a template and a whole policy tree, and Grafana shows them read-only (the Provisioned badge). The tree cannot get a new route from the interface, which is why this guide creates a separate named tree instead of editing it. The lab also provisions rules that deliver to the path /grafana of the same receiver, so your own contact point uses the path /guide to tell the two apart.

  • The guide was checked on Grafana Enterprise 13.3.0 (the free image, no licence key). Notification resources need the Editor or Admin role; admin has it.

  • The figures are drawings of the Grafana 13.3 user interface, not screenshots, so small details can differ from your screen. A highlighted box with a number marks the control of the step with the same number.

Steps

All four phases work on the page Alerting → Notification configuration, which has the tabs Contact points, Notification policies, Templates and Time intervals. The rule form is the one described by the screen map of the guide Create an alert rule; come back to it when a control is not where the figure shows it.

Create a webhook contact point

  1. In the left navigation, click Alerting, then Notification configuration.

  2. On the Contact points tab, click New contact point.

    Notification configuration page with the Alerting group of the navigation open: callout 1 marks Notification configuration and callout 2 marks the New contact point button of the Contact points tab, which lists the provisioned bookshelf-webhook and the unused empty
  3. In Name, type guide-webhook. If an earlier guide already created a contact point with this name, open it with Edit instead and continue with the URL step.

  4. In Integration, choose Webhook.

  5. In URL, type http://webhook-receiver:8080/guide. The receiver listens on port 8080 inside the lab network and on port 8081 of your machine.

    Create contact point form: the field Name holds guide-webhook (callout 3), the Integration select shows Webhook (callout 4) and the field URL holds the receiver address ending in slash guide (callout 5)
  6. Click Test, at the right of the integration block, and send the test notification in the dialog that opens.

  7. Click Save contact point.

    Create contact point form filled in: the Test button at the right of the Webhook integration block is marked by callout 6 and the Save contact point button at the bottom is marked by callout 7
  8. Ask the receiver what it got. The receiver keeps the last 50 requests and prints them on a plain GET:

    curl localhost:8081/

    One entry has the path /guide; its body is the JSON that Grafana posted, with guide-webhook as the receiver.

    Terminal showing the answer of the webhook receiver at localhost 8081: one received request with a time, the path slash guide, marked by callout 8, and a body whose receiver is guide-webhook

Write a notification template

  1. Click the Templates tab, then the button that adds a notification template group. The page that opens is titled New notification template group.

    Notification configuration page with the Templates tab selected, marked by callout 9; the list shows the provisioned template bookshelf
  2. In Template group name, type guide.

  3. In the Template group editor, replace the content with two definitions, one for the title and one for the message:

    {{ define "guide.title" -}}
    [{{ .Status | toUpper }}] {{ .CommonLabels.alertname }}
    {{- end }}
    
    {{ define "guide.message" -}}
    {{ range .Alerts -}}
    {{ .Labels.alertname }}: {{ .Annotations.summary }}
    {{ end -}}
    {{- end }}
  4. Click Refresh in the Preview pane. Before it, the pane reads "Add template content to see preview"; afterwards it renders each definition for the sample alert of the Payload pane.

  5. Click Save.

    New notification template group page: the field Template group name holds guide (callout 10), the Template group editor holds the definitions guide.title and guide.message (callout 11), the Refresh button of the Preview pane is marked by callout 12 and the Save button is marked by callout 13
  6. Use the template: on the Contact points tab, open guide-webhook with Edit, open the optional settings of the webhook integration, put {{ template "guide.title" . }} in the field for the title and {{ template "guide.message" . }} in the field for the message, and click Save contact point again. The labels of these optional fields were not read in the lab, so take the two text fields of the webhook settings that carry the words title and message.

Route alerts with a new notification policy tree

  1. Click the Notification policies tab.

  2. Click New notification policy.

    Notification policies tab: callout 15 marks the tab, and callout 16 marks the New notification policy button above the provisioned tree Default policy with one route and the Provisioned badge on every row
  3. In the dialog New notification policy, type guide-tree in Name.

  4. In Default contact point, choose guide-webhook. Leave Group by at grafana_folder and alertname, its default.

  5. Click Create.

    New notification policy dialog: the field Name holds guide-tree (callout 17), the Default contact point select shows guide-webhook (callout 18), Group by keeps grafana_folder and alertname, and the Create button is marked by callout 19
  6. In the tree guide-tree, click Add route. On the provisioned tree this control is disabled.

    Notification policies tab after Create: below the provisioned Default policy the new tree guide-tree has the default contact point guide-webhook and the default timings, and its Add route button is marked by callout 20
  7. In the dialog Add route, under Matching labels, type the label team, keep the operator = and type the value bookshelf-guides.

  8. In Contact point, choose guide-webhook.

  9. Turn on Override grouping. Group by is filled in with grafana_folder and alertname; remove grafana_folder so that alertname is the only label.

  10. Turn on Override general timings and set Group wait to 10s, Group interval to 1m and Repeat interval to 1h. These are the same values as the lab’s route for critical alerts.

  11. Click Add route.

    Form of the new route of guide-tree, shown with its values: the matcher team equals bookshelf-guides (callout 21), the contact point guide-webhook (callout 22), the grouping alertname (callout 23), the timings 10s, 1m and 1h (callout 24) and the Save button (callout 25)

Connect the rule and preview the routing

  1. In Alerting → Alert rules, open the rule Guide high 5xx ratio, click More and choose Edit.

    Rule page of Guide high 5xx ratio with the state badge Firing and the tabs Query and conditions, Instances, History and Versions; the More button at the top right is marked by callout 26
  2. In section 5 Configure notifications, turn on Advanced options.

  3. Under Recipient, the form says that notifications are routed by the notification policy tree and shows the select Default policy (a Change link opens it first when the rule used a contact point). Open the select and choose guide-tree.

  4. Click Preview routing under Alert instance routing preview. The preview lists one entry, Delivered to guide-webhook, with the integration webhook and the count 1 instances; expand it to see the labels of the rule instance (alertname, grafana_folder, severity and team) and the View route button.

  5. Click Save.

    Section 5 Configure notifications of the rule form: the toggle Advanced options is on (callout 27), the select of the notification policy tree shows guide-tree (callout 28) and the Save button at the bottom is marked by callout 30

Deliver a notification and read the payload

  1. Force the failure in the load generator:

    curl -X POST localhost:8090/mode/failing
  2. Wait about three minutes: the rule goes Pending after one evaluation and Firing after its pending period, then the group wait of the route (10s) elapses. Read the receiver; with jq installed, this filter keeps the deliveries of your contact point:

    curl -s localhost:8081/ | jq -c '.[] | select(.path=="/guide") | [.time, (.body|fromjson|.status, .title)]'

    Without jq, run curl localhost:8081/ and look for the entries whose path is /guide. The title comes from your template. Entries with the path /grafana belong to the provisioned rules, which fire during the same failure.

    Terminal showing the receiver filtered on the path slash guide: a first line with the status firing and the title FIRING Guide high 5xx ratio, marked by callout 32, and a later line with the status resolved
  3. Restore normal traffic. The rule returns to Normal after about a minute and the resolved notification follows at the next update of the group, within the 1m you set:

    curl -X POST localhost:8090/mode/normal

Check the result

  • Alerting → Notification configuration → Notification policies shows the tree guide-tree with the route team = bookshelf-guides.

  • The receiver holds a firing and a resolved delivery with the path /guide, and the title has the form [FIRING] Guide high 5xx ratio. The default payload also carries receiver, status, alerts (each with labels, annotations, fingerprint, dashboardURL and panelURL), groupLabels, commonLabels, externalURL and message.

  • Timings: in the lab, with the defaults of a rule that uses a contact point directly (group wait 30 s, group interval 5 m), the first webhook arrived 30 s after the rule went Firing and the resolved one exactly 5 m after it. This guide’s route shortens both to the 10s and 1m you set, so expect the deliveries sooner; the figures here were not measured with those values.

Variations

  • Set the contact point of the rule directly, with Advanced options off and a Contact point choice, to see the simplified routing: it needs no tree, and the same receiver gets the same payload.

  • Add a second child route under guide-tree for severity = warning with a longer repeat interval, and use Preview routing to check which route each label set takes.

What can go wrong

Symptom Cause Fix

Add route is disabled

You are looking at the provisioned tree, whose rows carry the Provisioned badge.

Use the tree guide-tree that you created with New notification policy.

The test notification does not reach the receiver

The URL uses localhost, which inside the Grafana container is the container itself, or the receiver is not running.

Use http://webhook-receiver:8080/guide, and check with curl localhost:8081/ that the receiver answers.

The receiver shows only entries with the path /grafana

The rule still uses another contact point, or the labels of the rule do not match the matcher.

Open the rule, check section 5 and the labels, or use Preview routing.

The title is the default one, not [FIRING] Guide high 5xx ratio

The template was saved, but the contact point does not call it.

Edit guide-webhook and enter the two template calls in the title and message fields of the webhook settings.

No notification arrives for several minutes

The group wait and the evaluation have not elapsed yet, or the failure stopped before the pending period ended.

Wait for the state Firing on the rule page, then read the receiver again; check the mode with curl localhost:8090/.

Clean up

Keep the contact point, the template and the tree: the next guide attaches a time interval to the route of guide-tree. Remove the failure with curl -X POST localhost:8090/mode/normal. To delete everything the lab stores, stop the profile with docker compose --profile grafana down -v.

Where to go next