Creating a Message Template
AOM provides message templates, enabling you to customize notifications. When a preset notification rule is triggered, notifications can be sent to specified personnel by email, SMS, WeCom, DingTalk, HTTP, or HTTPS. If no message template is created, the default message template will be used.
Procedure
- Log in to the AOM console and choose Alarm Center > Alarm Action Policies in the navigation pane. On the displayed page, click the Message Templates tab.
- Click Create. Alternatively, select a created message template and click Copy in the Operation column.
- Enter a template name.
- Enter a template description.
- Select a language. (Only simplified Chinese and English are supported.)
- Customize the template content. (Default fields are automatically filled when a message template is created.)
- You can create up to 100 message templates. If the number of templates exceeds the upper limit, delete unnecessary templates and create new ones.
- There are two default message templates. If you do not customize any message template, notifications will be sent based on default templates. The default templates cannot be deleted or edited.
- In addition to default message fields, the message template also allows you to customize fields. You need to define values for custom fields for event alarm reporting. For details about how to call related APIs, see the description of event alarm APIs. For details about the parameters, see the alarm reporting structs in the following message template.
- Custom fields support the JSONPath format. Example: $event.metadata.case1 or $event.metadata.case[0].
- In the upper right corner of the Body area, click Add Variables to add required variables.
- If you select Email, you can click Preview to view the final effect.
Table 1 Variables in the default message template Variable
Description
Definition
Notification Type
Type selected when a notification rule is created, which can be Alarm or Event.
${event_type}
Severity
Alarm or event severity, which can be Critical, Major, Minor, or Warning.
${event_severity}
Name
Name of the alarm or event that triggers the notification rule.
$event.metadata.event_name
Occurred
Time when the alarm or event is triggered.
${starts_at}
Source
Name of the service corresponding to the alarm or event that triggers the notification rule.
$event.metadata.resource_provider
Resource Type
Type of the resource selected when you customize a threshold rule or define alarm reporting.
$event.metadata.resource_type
Resource Identifier
Resource that triggers the alarm or event.
${resources}
Custom tag
Extended tag.
$event.metadata.key1
Possible Cause
Cause of the alarm. For non-custom reporting, "NA" is displayed.
${alarm_probableCause_zh}
Suggestion
Suggestion on how to handle the alarm. For non-custom reporting, "NA" is displayed.
${alarm_fix_suggestion_zh}
Custom annotation
Extended annotation.
$event.annotations.key2
Alarm reporting structs corresponding to the message template{ "events": [{ "starts_at": 1579420868000, //${starts_at} "ends_at": 1579420868000, "timeout": 60000, "resource_group_id": "5680587ab6*******755c543c1f", "metadata": { "event_name": "test", //${metadata.event_name} "event_severity": "Major", //${metadata.event_severity} "event_type": "alarm", //${metadata.event_type} "resource_provider": "ecs", //${metadata.resource_provider} "resource_type": "vm", //${metadata.resource_type} "resource_id": "ecs123", "key1": "Custom field" //$event.metadata.key1 }, "annotations": { "alarm_probableCause_zh_cn": "possible cause", //${annotations.alarm_probableCause_zh} "alarm_fix_suggestion_zh_cn": "fix suggestion", //${annotations.alarm_fix_suggestion_zh} "key2": "Custom field" //$event.annotations.key2 } }] } - Click Confirm. The message template is created.
Last Article: Creating an Alarm Action Policy
Next Article: Alarm Noise Reduction
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.