Docs: Adds preview notification template docs (#67903)

Adds preview notification template
This commit is contained in:
brendamuir 2023-05-08 09:21:20 +02:00 committed by GitHub
parent 3684ca7c02
commit 6464ce0239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,7 @@ To create a template, complete the following steps.
{{< figure max-width="940px" src="/static/img/docs/alerting/unified/new-notification-template-email-subject-9-4.png" caption="New notification template email.subject" >}}
4. Click Save.
4. Click **Save**.
`{{ define "email.subject" }}` and `{{ end }}` is automatically added to the start and end of the content:
@ -48,7 +48,43 @@ To create a notification template that contains more than one template:
{{< figure max-width="940px" src="/static/img/docs/alerting/unified/new-notification-template-email-9-4.png" caption="New notification template" >}}
4. Click Save.
4. Click **Save**.
## Preview notification templates
Preview how your notification templates will look before using them in your contact points, helping you understand the result of the template you are creating as well as enabling you to fix any errors before saving it.
**Note:** This feature is only for Grafana Alertmanager.
To preview your notification templates:
1. Navigate to **Alerts&IRM** -> **Alerting** -> **Contact points**.
1. Click **+Add template** or edit an existing template.
1. Add or update your template content.
Default data is provided and you can add or edit alert data to it as well as alert instances. You can add alert data directly in the Payload data window itself or click **Choose alert instances** or **Add alert data**.
1. [Optional] To add alert data from existing alert instances:
a. Click **Choose alert instances**.
b. Hover over the alert instances to view more information on each alert instance.
c. Click **Confirm** to add the alert instance(s) to the payload.
1. [Optional] To add alert data using the Alert data editor, click **Add alert data:**
a. Add annotations, custom labels and/or set a dashboard or a panel.
b. Toggle Firing/resolved depending on whether you want to add firing or resolved alerts to your notification.
c. Click **Add alert data to payload**.
d. Click **Refresh preview** to see what your template content will look like and the corresponding payload data.
If there are any errors in your template, they are displayed in the Preview and you can correct them before saving.
1. Click **Save.**
## Template the subject of an email