Skip to main content

Version: 3.2.16.6

Alert Variables and Templates

Alert policy notifications (emails and messages) can be customized with pre-defined variables to provide dynamic content.

Alert Variables

Alert variables are data evaluations in the template that are delimited by {{ and }}.

The following variables are available to be used in creating alert notifications(alert message, alert email subject, alert email content)

VariableDescription
{{ .AlertPolicyName }}Name of the alert policy.
{{ .Description }}Description of the alert policy.
{{ .Severity }}Severity of the alert policy.
{{ .TriggerGatewayGroup }}The names of the gateway groups that trigger alerts. Multiple groups may be specified, separated by commas.
{{ .AlertTime }}Time of the alert.
{{ .AlertDetail }}Detailed description of the specific event(s) triggering the alert. Multiple events are listed separately.
{{ .AlertTime.Format }}
  • The AlertDetail field is a string that can contain multiple event details, separated by newline characters (\n). To use this field in a JSON body, ensure proper escaping of newline characters.
{{ .AlertDetail | escape }}

Templates

Examples to configure alert notifications.

Alert Email Subject

`[API7 Alert] No Enough Healthy Gateway Instances in {{.TriggerGatewayGruop}} - [{{.Severity}}]`.

Alert Email Content

Dear [Recipient Name],

We are writing to inform you that an alert has been triggered for the API7 Gateway at {{.AlertTime.Format "2006 Jan 02 15:04:05"}}. The specific alert severity is {{.Severity}}.

Alert Details:

Gateway Groups: {{.TriggerGatewayGroup}}
Alert Message: {{.AlertDetail}}

Recommended Actions:

Investigate further: Please go check the related logs and metrics for more details. Restart service: Consider restarting the service. Escalate to on-call team: If the issue persists, please contact the on-call team.

Alert Message(JSON)

"text": "{{.AlertDetail | escape}}".
"timestamp": "{{.AlertTime.Format "2006 Jan 02 15:04:05"}}"
"system": "API7 Gateway, {{.TriggerGatewayGroup}}"
API7.ai Logo

The digital world is connected by APIs,
API7.ai exists to make APIs more efficient, reliable, and secure.

Sign up for API7 newsletter

Product

API7 Gateway

SOC2 Type IIISO 27001HIPAAGDPRRed Herring

Copyright © APISEVEN PTE. LTD 2019 – 2025. Apache, Apache APISIX, APISIX, and associated open source project names are trademarks of the Apache Software Foundation