Alert Template
An alert notification template is a pre-set template designed to dynamically generate alert messages by filling in placeholders with specific details at runtime. The placeholders are configured with variables in the template. It utilizes Go’s templating syntax to inject values such as the title, alert time, severity, and detailed description of the alert.
Variables
Template variables are data evaluations in the template that are delimited by {{
and }}
.
The following variables are available to be used in creating alert notification template.
Variable | Description |
---|---|
{{ .Name }} | Name of the alert policy. |
{{ .Description }} | Description of the alert policy. |
{{ .Severity }} | Severity of the alert policy. |
{{ .Class }} | Class of the alert policy. |
{{ .Title }} | Alert title. |
{{ .Detail }} | Alert detail. |
{{ .AlertTime }} | Time of the alert. |
{{ .AlertEvents }} | Condition that triggered the alert. |
Alert Time
{{ .AlertTime.Format }}
: Alert time format.
Alert Events
{{ .AlertEvents.number_of_status_code.Summary }}
: Summary of the number of status codes.{{ .AlertEvents.ratio_of_status_code.Summary }}
: Summary of the ratio of status codes.{{ .AlertEvents.control_plane_certificate_will_expire_in.Summary }}
: Summary of the control plane certificate that will expire.{{ .AlertEvents.gateway_certificate_will_expire_in.Summary }}
: Summary of the gateway certificate that will expire.{{ .AlertEvents.gateway_instance_offline.Summary }}
: Summary of the offline gateway instances.{{ .AlertEvents.dp_core_exceeded.Summary }}
: Summary of the time period the gateway instance CPU cores exceeds the maximum allowed CPU cores by license, which may affect new configuration changes.
Examples
Alert with Title, Time, Severity, and Detail
API7 alert! See details below.
Title: {{ .Title }}
AlertTime: {{ .AlertTime.Format "2006 Jan 02 15:04:05" }}
Severity: {{ .Severity }}
Detail: {{ .Detail }}
Identify Alert Triggers
Alert triggered by
{{if .AlertEvents.dp_core_exceeded }} {{ .AlertEvents.dp_core_exceeded.Summary }} {{end}}
{{if .AlertEvents.gateway_instance_offline }} {{ .AlertEvents.gateway_instance_offline.Summary }} {{end}}