Configures the event subscription settings for a database instance.
Operation description
Note the following before calling this operation:
-
If you use an Alibaba Cloud SDK or a DAS SDK, use the latest version.
-
If you use an SDK to call DAS API operations, set the region ID to cn-shanghai.
-
The database instance is connected to DAS.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
hdm:SetEventSubscription |
update |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
The instance ID. |
rm-2ze8g2am97624**** |
| EventContext |
string |
No |
The event scenarios to subscribe to. Set to AllContext for all scenarios. |
AllContext |
| Lang |
string |
No |
The language of event notifications. Set to zh-CN for Chinese notifications. |
zh-CN |
| MinInterval |
string |
No |
The minimum interval between consecutive event notifications. Unit: seconds. |
60 |
| ContactName |
string |
No |
The alert notification contact. Separate multiple names with commas (,). |
Default contact |
| ChannelType |
string |
No |
The notification method. Valid values:
|
hdm_alarm_sms,dingtalk |
| ContactGroupName |
string |
No |
The alert notification contact group. Separate multiple names with commas (,). |
Default contact group |
| Level |
string |
No |
The risk level of the events. Valid values:
Event level definitions:
|
Optimization |
| Active |
string |
No |
Whether to enable event subscription. Valid values:
|
1 |
| Severity |
string |
No |
The alert severity based on the event type. Format: Event types:
Alert severities:
|
{"AutoScale":"critical","SQLThrottle":"info","TimeSeriesAbnormal":"warning"} |
| DispatchRule |
string |
No |
Event-type-specific notification rules. If empty, the MinInterval and ChannelType values apply. 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 elements
|
Element |
Type |
Description |
Example |
|
object |
The response body. |
||
| RequestId |
string |
The request ID. |
097F0C56-B252-515A-B602-FC56EF93EF8A |
| Message |
string |
The response message. Note
Returns Successful for success, or an error code for failure. |
Successful |
| Data |
object |
The returned data. |
|
| userId |
string |
The user ID. |
1088760496**** |
| instanceId |
string |
The instance ID. |
rm-2ze8g2am97624**** |
| eventContext |
string |
The event scenarios. Returns AllContext, indicating all scenarios are supported. |
AllContext |
| lang |
string |
The notification language. Returns zh-CN, indicating Chinese notifications. |
zh_CN |
| active |
integer |
Whether event subscription is enabled. Valid values:
|
1 |
| minInterval |
integer |
The minimum interval between consecutive event notifications. Unit: seconds. |
60 |
| contactName |
string |
The alert notification contact. Multiple names are separated by commas (,). |
Default contact |
| contactGroupName |
string |
The alert notification contact group. Multiple names are separated by commas (,). |
Default contact group |
| channelType |
string |
The notification method. Valid values:
|
hdm_alarm_sms,dingtalk |
| level |
string |
The risk level of the events. Valid values:
|
Optimization |
| Code |
string |
The HTTP status code. |
200 |
| Success |
string |
Whether the request was successful. Valid values:
|
true |
Examples
Success response
JSON format
{
"RequestId": "097F0C56-B252-515A-B602-FC56EF93EF8A",
"Message": "Successful",
"Data": {
"userId": "1088760496****",
"instanceId": "rm-2ze8g2am97624****",
"eventContext": "AllContext",
"lang": "zh_CN",
"active": 1,
"minInterval": 60,
"contactName": "Default contact",
"contactGroupName": "Default contact group",
"channelType": "hdm_alarm_sms,dingtalk",
"level": "Optimization"
},
"Code": "200",
"Success": "true"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParams | The request parameters are invalid. | |
| 403 | NoPermission | You are not authorized to do this action. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.