This topic describes how to create an alert notification template to customize notification titles and content.
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 under More.
On the Alert Notification Template tab, click Create notification template.
Configure the template rules and click Create.
Note
For security verification purposes, the alert notification content template must contain the characters "OBCloud" or "OceanBase".
ParameterDescriptionTemplate Name The name of the alert notification template. Notification Method Available formats depend on the notification method. - Email: Enter a title and content.
- DingTalk: Enter a title and content.
- Feishu: Enter content in text format.
- Custom URL: The default template uses JSON. Modify it to match the format supported by the target URL. See Custom URL format examples.
Alert Type You can select Metric or Event. Alert Notification Effective Time 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 at most 50 characters, including the content after variables are rendered. 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 side. You can enter variables in the ${AlertName}format, where AlertName is the alert name. For supported variables, see Alert variables.Note
The length is limited to at most 500 characters, including the content after variables are rendered. Excess content will be truncated.
Alert Resolution Notification Template Title The title displayed in the alert resolution notification. You can enter variables in the ${AlertName}format, where AlertName is the alert name.Note
The length is limited to at most 50 characters, including the content after variables are rendered. Excess content will be truncated.
Alert Resolution Notification Template Content The content displayed in the alert resolution notification. You can preview and test sending it on the right side. You can enter variables in the ${AlertName}format, where AlertName is the alert name. For supported variables, see Alert variables.Note
The length is limited to at most 500 characters, including the content after variables are rendered. 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 Target | ${AlertTarget} |
| 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
For information about webhook URLs for DingTalk, Feishu, Slack, and Telegram bots, and about custom URL configuration, see Get a webhook URL.
For example, the following command calls the DingTalk bot 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
Configure the custom URL and notification content as follows:
The custom URL format is as follows:
https://oapi.dingtalk.com/robot/send?access_token=********The content format of the alert notification template is as follows:
{ "msgtype": "text", "text": { "content": "Hello!\n\nYour OceanBase Cloud database ${AlertTarget} triggered a ${MetricNames} alert (${AlertLevel}) at ${AlertStartTime}. Review and address the alert.\nAlert name: ${AlertName}\nSummary: ${AlertSummary}\nDescription: ${AlertDescription}\nRelated metrics: ${MetricNames}\nTriggered at: ${AlertStartTime}\nLast updated at: ${AlertUpdateTime}\nRelated resources: ${AlertResourceInfo}\nAlert details: ${AlertDetailUrl}" } }