mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
Make clear that the two example templates must be used together (#48305)
* make clear that the two templates work in conjunction * PR review changes * Update docs/sources/alerting/unified-alerting/message-templating/_index.md Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> * Update docs/sources/alerting/unified-alerting/message-templating/_index.md Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> * make numbered steps Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
This commit is contained in:
parent
6be21d66e6
commit
9237729c19
@ -79,11 +79,11 @@ You can use any of the following built-in template options to embed custom templ
|
||||
| `default.message` | Provides a formatted summary of firing and resolved alerts. |
|
||||
| `teams.default.message` | Similar to `default.messsage`, formatted for Microsoft Teams. |
|
||||
|
||||
### Custom template examples
|
||||
### Example of a custom template
|
||||
|
||||
Here are a few examples of how to use custom templates.
|
||||
Here's an example of how to use a custom template. You can also use the default template included in the setup.
|
||||
|
||||
Template to render a single alert:
|
||||
Step 1: Configure a template to render a single alert.
|
||||
|
||||
```
|
||||
{{ define "myalert" }}
|
||||
@ -110,7 +110,7 @@ Template to render a single alert:
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Template to render entire notification message:
|
||||
Step 2: Configure a template to render entire notification message.
|
||||
|
||||
```
|
||||
{{ define "mymessage" }}
|
||||
@ -125,6 +125,13 @@ Template to render entire notification message:
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Step 3: Add `mymessage` in the notification message field.
|
||||
|
||||
```
|
||||
Alert summary:
|
||||
{{ template "mymessage" . }}
|
||||
```
|
||||
|
||||
### HTML in message templates
|
||||
|
||||
HTML in alerting message templates is escaped. We do not support rendering of HTML in the resulting notification.
|
||||
|
Loading…
Reference in New Issue
Block a user