Message Templates
A message template defines the format of alarm notification messages sent to subscribers. LTS provides built-in keywords_template (Chinese and English) and sql_template (Chinese and English). Subscribers can select templates based on protocols. If the template of a specified protocol does not exist, the built-in template is used to send messages to subscribers of that protocol. When using a message template to send alarm notification messages, the system automatically replaces the template variables with the content in the alarm rule.
Creating a Message Template
- On the LTS console, choose Alarms > Alarm Action Rules.
By default, LTS provides the following built-in message templates. If no message content is configured in your selected template, LTS uses a built-in template instead.
- keywords_template: keyword alarm template
- keywords_template: keyword alarm template
- sql_template: SQL alarm template
- sql_template: SQL alarm template
- Click Create on the Message Templates tab page. On the displayed page, set the required parameters.
Table 1 Message template parameters Parameter
Description
Verification Rule
Example
Template Name
Message template name.
Include digits, letters, underscores (_), and hyphens (-). Do not start or end with an underscore or hyphen. (Max. 100 characters)
LTS-test
Description
Description of the template.
Include digits, letters, and underscores (_). Do not start or end with an underscore. (Max. 1024 characters)
-
Message Header
Default message header to be added in messages.
- Chinese (Simplified)
- English
- Chinese: "Dear user,"
- "Dear user,"
Notification method
Notification method.
- SMS
- HTTP/HTTPS
- DingTalk
- Lark
- WeCom
- Voice
NOTE:
The functions of voice and Lark are available only to whitelisted users. To use them, submit a service ticket.
-
Topic
Message topic.
Customize the topic name or use variables. (Max. 512 characters)
Only email templates need a topic name.
test
Body
Message content.
Add Variable
- Original rule name: ${event_name}
- Alarm severity: ${event_severity}
- Occurrence time: ${starts_at}
- Occurrence region: ${region_name}
- Huawei Cloud account: ${domain_name}
- Alarm source: $event.metadata.resource_provider
- Resource type: $event.metadata.resource_type
- Resource ID: ${resources}
- Alarm status: $event.annotations.alarm_status
- Expression: $event.annotations.condition_expression
- Current value: $event.annotations.current_value
- Statistical period: ${frequency}
- Rule name: ${event_name}
- Variables supported by keyword alarms:
- Query time: $event.annotations.results[0].time
- Query log:
- Query URL:
- Log group/stream name: $event.annotations.results[0].resource_id
NOTE:
Only the original name of the log group or log stream created for the first time can be added. The modified log group or log stream name cannot be added.
- Query custom field: $event.annotations.results[0].fields.xxx
NOTE:
xxx indicates a structured or built-in field (such as hostIP and hostName) in raw logs.
- Variables supported by SQL alarms:
- Log group/stream names of chart 0: $event.annotations.results[0].resource_id
NOTE:
Only the original name of the log group or log stream created for the first time can be added. The modified log group or log stream name cannot be added.
- Query statement of chart 0: $event.annotations.results[0].sql
- Query time of chart 0: $event.annotations.results[0].time
- Query URL of chart 0: $event.annotations.results[0].url
- Query log of chart 0: $event.annotations.results[0].raw_results
- Log group/stream names of chart 0: $event.annotations.results[0].resource_id
Copy from Existing
- keywords_template
- sql_template
- sql_template
- keywords_template
- Custom templates (created with variables)
${event_name}
${event_severity}
${starts_at}
${region_name}
- Create a message template.
- Copy from an existing template.
- The email content supports HTML tags and message preview.
- Templates such as WeCom, Lark, and DingTalk support markdown syntax and message preview.
- You can create up to 100 message templates for AOM and LTS. If there are already 100 templates, delete unnecessary templates before creating a new one.
- When the configuration is complete, click OK.
Modifying a Message Template
- In the message template list, click Modify in the row that contains the target template, and modify the template according to Table 1. The template name cannot be modified.
Built-in message templates cannot be modified.
- Click OK.
Copying a Message Template
- In the message template list, click Copy in the row that contains the target template, and set a new template name.
- Click OK.
Deleting a Message Template
Deleting a Single Message Template
- In the message template list, click Delete in the Operation column of the target template.
Built-in message templates cannot be deleted.
- Click OK.
Deleting Multiple Message Templates
- In the message template list, select the templates to be deleted and click Delete above the list.
- Click OK.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot