Alert templates define notification formats for different channels. When specific conditions are met, ActionTrail sends alert notifications to the specified users or user groups based on the configured template.
Create an alert template
By default, ActionTrail uses the SLS actiontrail builtin content template to send alert notifications. You can also create a custom alert template.
-
Log on to the ActionTrail console.
-
In the left-side navigation pane, click Event Alerting.
-
On the Alert Center page, choose .
-
Click Create.
-
In the Add Alert Template dialog box, set Identifier and Name.
-
Specify the notification content for each alert notification method.
Notification method
Description
SMS
You can configure the following parameters:
-
Language: The notification language. Valid values: Chinese and English.
-
Send Content: The notification content. You can use template variables to customize the content. For more information, see alert template variables (new).
Voice
You can configure the following parameters:
-
Language: The notification language. Valid values: Chinese (recommended) and English.
-
Send Content: The notification content. You can use template variables to customize the content. For more information, see alert template variables (new).
Email
You can configure the following parameters:
-
Language: The notification language. Valid values: Chinese and English.
-
Subject: The subject of the alert message. You can also use a template variable to define the subject.
-
Send Content: The notification content. You can use template variables to customize the content. For more information, see alert template variables (new).
DingTalk
You can configure the following parameters:
-
Language: The notification language. Valid values: Chinese and English.
-
Disable View Details: Disables the default link for viewing alert details or managing alert rules without logging on. For more information, see View alert details without logging on.
-
Title: The title of the alert message. You can also use a template variable to define the title.
-
Send Content: The notification content. You can use template variables to customize the content. For more information, see alert template variables (new).
Webhook-Custom
You can configure the following parameters:
-
Sending Mode: The method used to send notifications. Valid values: single and batch.
For example, you enter
{ "project": "{{project}}", "alert_name": "{{alert_name}}"}in the Content field, and two alerts are triggered.-
Single: Two alert notifications are separately sent. The content is
{ "project": "project-1", "alert_name": "alert-1"}and{ "project": "project-2", "alert_name": "alert-2"}. -
Batch: Two alert notifications are sent at a time. The content is
[{ "project": "project-1", "alert_name": "alert-1"}, { "project": "project-2", "alert_name": "alert-2"}].-
If you select Batch and set the Maximum number of items sent in a group parameter to N, an alert notification for the first N alerts in a merge set is sent.
-
If you select Batch and the content that you specify can be parsed into JSON data, an alert notification is sent in the JSON format. If the content cannot be parsed into JSON data, an alert notification is sent as an array that contains strings.
-
-
-
Maximum Number of Items Sent per Group: The maximum number of alerts to send per group. Valid values: Unlimited and Custom.
-
Send Content: The notification content. You can use template variables to customize the content. For more information, see alert template variables (new).
NoteBy default, alert notifications are sent with the Content-Type: application/json;charset=utf-8 request header. If your webhook endpoint requires a different request header format, you can define a custom request header when you configure the notification channel. For more information, see webhook-custom.
Notifications
You can configure the following parameters:
-
Language: The notification language. Valid values: Chinese and English.
-
Send Content: The notification content. You can use template variables to customize the content. For more information, see alert template variables (new).
WeCom
You can configure the following parameters:
-
Language: The notification language. Valid values: Chinese and English.
-
Title: The title of the alert message. You can also use a template variable to define the title.
-
Send Content: The notification content. You can use template variables to customize the content. For more information, see alert template variables (new).
Lark
You can configure the following parameters:
-
Language: The notification language. Valid values: Chinese and English.
-
Disable View Details: Disables the default link for viewing alert details or managing alert rules without logging on. For more information, see View alert details without logging on.
-
Title: The title of the alert message. You can also use a template variable to define the title.
-
Send Content: The notification content. You can use template variables to customize the content. For more information, see alert template variables (new).
Slack
You can configure the following parameters:
-
Language: The notification language. Valid values: Chinese and English.
-
Title: The title of the alert message. You can also use a template variable to define the title.
-
Send Content: The notification content. You can use template variables to customize the content. For more information, see alert template variables (new).
EventBridge
You can configure the following parameters:
-
Subject: The subject of the alert message. You can also use a template variable to define the subject.
-
Send Content: The notification content. You can use template variables to customize the content. For more information, see alert template variables (new).
Function Compute
You can configure the following parameters:
-
Sending Mode: The method used to send notifications. Valid values: single and batch.
For example, you enter
{ "project": "{{project}}", "alert_name": "{{alert_name}}"}in the Content field, and two alerts are triggered.-
Single: Two alert notifications are separately sent. The content is
{ "project": "project-1", "alert_name": "alert-1"}and{ "project": "project-2", "alert_name": "alert-2"}. -
Batch: Two alert notifications are sent at a time. The content is
[{ "project": "project-1", "alert_name": "alert-1"}, { "project": "project-2", "alert_name": "alert-2"}].-
If you select Batch and set the Maximum number of items sent in a group parameter to N, an alert notification for the first N alerts in a merge set is sent.
-
If you select Batch and the content that you specify can be parsed into JSON data, an alert notification is sent in the JSON format. If the content cannot be parsed into JSON data, an alert notification is sent as an array that contains strings.
-
-
-
Maximum Number of Items Sent per Group: The maximum number of alerts to send per group. Valid values: Unlimited and Custom.
-
Send Content: The notification content. You can use template variables to customize the content. For more information, see alert template variables (new).
-
-
Click Confirm.
Modify an alert template
-
In the Actions column of the target alert template, click Edit.
-
In the Edit Alert Template dialog box, modify the Name and the content for each notification channel.
-
Click Confirm.
Delete an alert template
Before you delete an alert template, make sure that no action policies of alert rules reference it. If you delete a referenced template, ActionTrail falls back to the SLS actiontrail builtin content template for notifications.
To prevent alert notification exceptions, do not delete the SLS actiontrail builtin content template.
-
In the Actions column of the target alert template, click Delete.
-
Click Confirm.
References
-
You can also configure alert templates in Simple Log Service. See Create an alert template.
-
Alert template syntax provides custom rendering logic for notifications. See Syntax for new alert templates.
-
For information about built-in functions in alert templates, see Built-in functions in alert templates.