From 9237729c194350dccc112470d0d82d3c47c4f4a7 Mon Sep 17 00:00:00 2001 From: Santiago Date: Wed, 27 Apr 2022 12:43:45 -0300 Subject: [PATCH] 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> --- .../unified-alerting/message-templating/_index.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/sources/alerting/unified-alerting/message-templating/_index.md b/docs/sources/alerting/unified-alerting/message-templating/_index.md index a83efa158be..10a97c30480 100644 --- a/docs/sources/alerting/unified-alerting/message-templating/_index.md +++ b/docs/sources/alerting/unified-alerting/message-templating/_index.md @@ -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.