Sample Notification Templates
This section provides ready-to-use examples of notification templates to help you quickly format alert messages.
Important Template Fields
Section titled “Important Template Fields”| Label | Description |
|---|---|
alert_code | Custom code representing the alert for easy tracking. |
alertname | Full name or title describing the alert situation. |
dataset | Dataset is a collection of data within the data source associated with the alert. |
table | Table name related to the dataset triggering the alert. |
severity | Severity level of the alert (e.g., critical, warning). |
description | Provides a brief, high-level overview of the alert rule for quick identification. |
summary | Offers detailed context and explanation of the alert, helping users understand its cause and impact. |
Notification Template Examples — Code Snippets and Email Previews
Section titled “Notification Template Examples — Code Snippets and Email Previews”Example 1
Section titled “Example 1”Example snippet for the email body:
{{ define "Notification-email" -}}{{ range .Alerts -}} {{- $alertCode := index .Labels "alert_code" -}} {{- $alertName := index .Labels "alertname" -}} {{- $dataset := index .Labels "dataset" -}} {{- $summary := index .Annotations "summary" -}} {{- $table := index .Labels "table" -}} {{- $severity := index .Labels "severity" -}} {{- $name := index .Labels "alertName" -}} {{- $description := index .Annotations "description" -}} {{- if and $alertCode $alertName $description $severity -}} {{- if not (or (match "DatasourceNoData" $alertName) (match "DatasourceError" $alertName)) }} {{- if eq $severity "critical" }} 🚨 {{ title $severity }} Alert: {{ $alertName }} {{- else if eq $severity "warning" }} ⚠️ {{ title $severity }} Alert: {{ $alertName }} {{- end }} {{- if and $dataset (ne $dataset "all") }} 📦 Dataset: "{{ $dataset }}" {{- end }} {{- if $table }} 📊 Table: "{{ $table }}" {{- end }} 📛 Alert Code: {{ $alertCode }} 📌 Impact Summary: {{ $summary }} 🔗 For more assistance reach out to administrative support or refer https://docs.obsrv.ai/how-tos/alerts-and-notifications/alerts-and-recommended-actions {{- end }} {{- end -}}{{ end -}}{{ end }}Below is an example of how the email notification looks when triggered:

Example 2
Section titled “Example 2”Example snippet for the email body:
{{ define "Simple-Notification-Template" -}}{{ range .Alerts -}}📛 Alert Code: {{ index .Labels "alert_code" }}🏷️ Alert Name: {{ index .Labels "alertname" }}⚠️ Severity: {{ index .Labels "severity" }}📝 Summary: {{ index .Annotations "description" }}🖥️ Alert Source: {{ index .Labels "alertSource" }}📊 Dataset: {{ index .Labels "dataset" }}🔗 For more assistance reach out to administrative support or refer https://obsrv.sunbird.org/{{ end -}}{{ end }}Below is an example of how the email notification looks when triggered:
