Creating a new alert notification template allows you to quickly set alert rules in batches for business objects.
Procedure
Log in to the OceanBase Cloud console.
In the left-side navigation pane, click Alerts.
On the Alert Management page, click the Alert Notification Templates tab.
On the Alert Notification Template tab, click Create Notification Template.
Configure the template rules and click Create.
Notice
For security verification reasons, the alert notification content template must contain the characters "OBCloud" or "OceanBase".
ParameterDescriptionTemplate Name The name of the alert notification template. Alert Method The method of alert notification. Different notification methods support different formats. - Email: Enter the title and content of the alert notification template.
- DingTalk: Enter the title and content of the alert notification template.
- Lark: Text format. Enter the content of the alert notification template.
- WeCom: Text format. Enter the content of the alert notification template.
- Custom URL: Default template in JSON format. You can modify it according to the supported custom URL format. For examples, see the Custom URL format examples section in this topic.
Alert Type You can select Metric or Event. Alert Notification Effective Time (UTC+8) The start and end times of the effective period refer to two points on the same day, and the start time must be earlier than the end time. If the effective time is not specified, the alert rule takes effect throughout the day. Alert Notification Template Title The title displayed in the alert notification. You can enter variables in the ${alertName}format, where alertName is the alert name.Note
The length is limited to 50 characters at most, including the content after variable parsing. Excess content will be truncated.
Alert Notification Template Content The content displayed in the alert notification. You can preview and test sending it on the right. You can enter variables in the ${alertName}format, where alertName is the alert name. For supported variables, see [Alert variables](#Alert variables).Note
The length is limited to 500 characters at most, including the content after variable parsing. Excess content will be truncated.
Alert Cancellation Notification Template Title The title displayed in the alert cancellation notification. You can enter variables in the ${alertName}format, where alertName is the alert name.Note
The length is limited to 50 characters at most, including the content after variable parsing. Excess content will be truncated.
Alert Cancellation Notification Template Content The content displayed in the alert cancellation notification. You can preview and test sending it on the right. You can enter variables in the ${alertName}format, where alertName is the alert name. For supported variables, see [Alert variables](#Alert variables).Note
The length is limited to 500 characters at most, including the content after variable parsing. Excess content will be truncated.
After creation, you can view it in the list and manage it through the Actions column.
Alert variables
The following variables are currently supported for use in alert notifications:
Variable Description |
Variable name |
|---|---|
| Alert Name | ${AlertName} |
| Alert Level | ${AlertLevel} |
| Alert Metric Name | ${MetricNames} |
| Alert Trigger Time | ${AlertStartTime} |
| Last Alert Time | ${AlertUpdateTime} |
| Alert Target Information | ${AlertResourceInfo} |
| Alert Overview | ${AlertSummary} |
| Alert Description | ${AlertDescription} |
| Alert Details URL | ${AlertDetailUrl} |
Custom URL format examples
Common custom URLs are obtained from DingTalk chatbots, Lark chatbots, or WeCom chatbots. For more information, see Obtain a webhook URL.
For example, here is an example of calling the DingTalk chatbot API:
curl 'https://oapi.dingtalk.com/robot/send?access_token=********' \
-X 'POST' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data '{"msgtype": "text", "text": {"content": "OceanBase test"} }' \
--compressed
The content to be filled in the alert rule and notification template configuration is as follows:
The custom URL format is as follows:
https://oapi.dingtalk.com/robot/send?access_token=********The alert notification template content format is as follows:
{ "msgtype": "text", "text": { "content": " Dear ${userName}, Hello! Your OBCloud database ${AlertTarget} has triggered a ${MetricNames} (${AlertLevel}) alert at ${AlertStartTime}. Please pay attention and handle it promptly. Alert name: ${AlertName} Alert summary: ${AlertSummary} Alert description: ${AlertDescription} Related metrics: ${MetricNames} Trigger time: ${AlertStartTime} Last update time: ${AlertUpdateTime} Related resource information: ${AlertResourceInfo} Alert details: ${AlertDetailUrl}" } }
