Sample Notification Templates

This section provides ready-to-use examples of notification templates to help you quickly format alert messages.

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

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:

Example Snippet for the email Body.

Below is an example of how the email notification looks when triggered:

Note: For a basic guide on creating a custom notification template, refer Notification Template Setup Guide

Last updated