Configures the event subscription settings for a database instance.
Operation description
Before you call this operation, take note of the following items:
- If you use an Alibaba Cloud SDK or a Database Autonomy Service (DAS) SDK to call this operation, we recommend that you use the latest version of the SDK.
- If you use an SDK to call the API operations of DAS, you must set the region ID to cn-shanghai.
- Make sure that the database instance that you want to manage is connected to DAS.
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
InstanceId | string | Yes | The instance ID. | rm-2ze8g2am97624**** |
EventContext | string | No | The supported event scenarios. You can set the value to AllContext, which indicates that all scenarios are supported. | AllContext |
Lang | string | No | The language of event notifications. You can set the value to zh-CN, which indicates that event notifications are sent in Chinese. | zh-CN |
MinInterval | string | No | The minimum interval between consecutive event notifications. Unit: seconds. | 60 |
ContactName | string | No | The name of the contact who receives alert notifications. Separate multiple names with commas (,). | Default contact |
ChannelType | string | No | The notification method. Valid values:
| hdm_alarm_sms,dingtalk |
ContactGroupName | string | No | The name of the contact group that receives alert notifications. Separate multiple names with commas (,). | Default contact group |
Level | string | No | The risk level of the events. Valid values:
The following content describes the events at each level in detail:
| Optimization |
Active | string | No | Specifies whether to enable the event subscription feature. Valid values:
| 1 |
Severity | string | No | The alert severity based on the event type. Specify this parameter in the following format: Valid values of event types:
Valid values of alert severities:
| {"AutoScale":"critical","SQLThrottle":"info","TimeSeriesAbnormal":"warning"} |
DispatchRule | string | No | The notification rules based on the event type. If you leave this parameter empty, the values of MinInterval and ChannelType prevail. Specify this parameter in the following format:
| {"silenced": {"AutoScale":1, "SQLThrottle":0, "TimeSeriesAbnormal": 1}, "min_interval": {"AutoScale":300, "SQLThrottle":360, "TimeSeriesAbnormal": 120}, "alert_type": {"AutoScale":"hdm_alarm_sms", "SQLThrottle":"hdm_alarm_sms_and_email", "TimeSeriesAbnormal": "hdm_alarm_sms,dingtalk"}} |
Response parameters
Examples
Sample success responses
JSON
format
{
"Code": "200",
"Data": {
"active": 1,
"channelType": "hdm_alarm_sms,dingtalk",
"contactGroupName": "Default contact group",
"contactName": "Default contact",
"eventContext": "AllContext",
"instanceId": "rm-2ze8g2am97624****",
"lang": "zh_CN",
"level": "Optimization",
"minInterval": 60,
"userId": "1088760496****"
},
"Message": "Successful",
"RequestId": "097F0C56-B252-515A-B602-FC56EF93EF8A",
"Success": "true"
}
Error codes
HTTP status code | Error code | Error message |
---|---|---|
400 | InvalidParams | The request parameters are invalid. |
403 | NoPermission | You are not authorized to do this action. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-04-25 | The request parameters of the API has changed | View Change Details |