* 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>
(cherry picked from commit 9237729c19)
Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
This commit is contained in:
co-authored by
Santiago
parent
95c8a9f207
commit
e3bcaa3475
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user