ActionTrail sends alert notifications to the users or user groups that you specify as alert contacts based on the content defined in alert templates. This topic describes how to create, modify, and delete an alert template.

Create an alert template

By default, ActionTrail uses the SLS actiontrail builtin content template to send alert notifications to the specified alert contacts. You can also create custom alert templates based on your business requirements.

  1. Log on to the ActionTrail console.
  2. In the left-side navigation pane, click Event Alerting.
  3. On the Event Alerting page, select Alert Template from the Alert Management drop-down list.
  4. In the Alert Template section, click Create.
  5. In the Add Content Template dialog box, set the ID and Name parameters.
  6. Configure the notification content for each alert notification method.
    Tab Parameter
    SMS You can set the following parameters:
    • Language: the language of an alert notification. Valid values: Chinese and English.
    • Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
    Voice You can set the following parameters:
    • Language: the language of an alert notification. Valid values: Chinese and English.
    • Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
    Email You can set the following parameters:
    • Language: the language of an alert notification. Valid values: Chinese and English.
    • Subject: the subject of an alert notification. You can enter a subject or use template variables to specify the subject of an alert notification.
    • Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
    DingTalk You can set the following parameters:
    • Title: the title of an alert notification. You can enter a title or use template variables to specify the title of an alert notification.
    • Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
    Webhook-Custom You can set the following parameters:
    • Sending Mode: the method by which alert notifications are sent. Valid values: Single and Batch.
      For example, you add the following template variables to the Content parameter: { "project": "${project}", "alert_name": "${alert_name}"}. If two alerts are triggered, two alert notifications are sent by using one of the following methods:
      • Single: Log Service sends the two alert notifications in sequence. Content: { "project": "project-1", "alert_name": "alert-1"} and { "project": "project-2", "alert_name": "alert-2"}.
      • Batch: Log Service sends one message that includes the two alert notifications. Content: [{ "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 merged 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.
    • Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
    Note When Log Service sends alert notifications, the request header Content-Type: application/json;charset=utf-8 Header is used by default. If a webhook receiver requires a request header in a different format, you can customize the request header when you configure the notification method. For more information, see Webhook-Custom.
    Notifications You can set the following parameters:
    • Language: the language of an alert notification. Valid values: Chinese and English.
    • Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
    Enterprise WeChat You can set the following parameters:
    • Title: the title of an alert notification. You can enter a title or use template variables to specify the title of an alert notification.
    • Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
    Lark You can set the following parameters:
    • Title: the title of an alert notification. You can enter a title or use template variables to specify the title of an alert notification.
    • Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
    Slack You can set the following parameters:
    • Title: the title of an alert notification. You can enter a title or use template variables to specify the title of an alert notification.
    • Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
    EventBridge You can set the following parameters:
    • Subject: the subject of an alert notification. You can enter a subject or use template variables to specify the subject of an alert notification.
    • Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
    Function Compute You can set the following parameters:
    • Sending Mode: the method by which alert notifications are sent. Valid values: Single and Batch.
      For example, you add the following template variables to the Content parameter: { "project": "${project}", "alert_name": "${alert_name}"}. If two alerts are triggered, two alert notifications are sent by using one of the following methods:
      • Single: Log Service sends the two alert notifications in sequence. Content: { "project": "project-1", "alert_name": "alert-1"} and { "project": "project-2", "alert_name": "alert-2"}.
      • Batch: Log Service sends one message that includes the two alert notifications. Content: [{ "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 merged 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.
    • Content: the content of an alert notification. You can directly enter content or use template variables to specify the content of an alert notification. For more information, see Variables in new alert templates.
  7. Click OK.

Modify an alert template

  1. Find the alert template that you want to modify and click Edit in the Actions column.
  2. In the Edit Alert Template dialog box, change the name of the alert template or modify the information specified for the alert notification methods. For example, you can modify the content of the alert notification specified for an alert notification method.
  3. Click OK.

Delete an alert template

Before you delete an alert template, make sure that the alert template is not referenced by the action policies of alert rules. If you delete the alert template referenced by the action policy of an alert rule, ActionTrail uses the SLS actiontrail builtin content template to send alert notifications.

Note To prevent alert notification exceptions, do not delete the SLS actiontrail builtin content template.
  1. Find the alert template that you want to delete and click Delete in the Actions column.
  2. In the message that appears, click OK.