All Products
Search
Document Center

Database Autonomy Service:SetEventSubscription

Last Updated:Aug 28, 2026

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

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

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: text message.

  • dingtalk: DingTalk chatbot.

  • hdm_alarm_sms_and_email: text message and email.

  • hdm_alarm_sms,dingtalk: text message and DingTalk chatbot.

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:

  • Notice: subscribes to Notice, Optimization, Warn, and Critical events.

  • Optimization: subscribes to Optimization, Warn, and Critical events.

  • Warn: subscribes to Warn and Critical events.

  • Critical: subscribes to Critical events only.

Event level definitions:

  • Notice: database exceptions without optimization suggestions.

  • Optimization: events with optimization suggestions based on database status.

  • Warn: events that may affect database performance.

  • Critical: events that affect database performance.

Optimization

Active

string

No

Whether to enable event subscription. Valid values:

  • 0: disabled.

  • 1: enabled.

1

Severity

string

No

The alert severity based on the event type.

Format: {"Event type 1":"Alert severity", "Event type 2":"Alert severity"}.

Event types:

  • AutoScale: auto scaling.

  • SQLThrottle: SQL throttling.

  • TimeSeriesAbnormal: time series anomaly detection.

  • SQLOptimize: SQL optimization.

  • ResourceOptimize: storage optimization.

Alert severities:

  • info

  • noticed

  • warning

  • critical

{"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": {"Event type 1":Specifies whether to enable adaptive silence, "Event type 2":Specify whether to enable adaptive silence},"min_interval": {"Event type 1":Minimum interval between event notifications, "Event type 2":Minimum interval between event notifications},"alert_type": {"Event type 1":"Notification method", "Event type 2":"Notification method"}}.

  • silenced: whether to enable adaptive silence. When enabled, the notification interval is the greater of the min_interval value and one third of the event duration. Valid values:

    • 1: enables adaptive silence.

    • 2: disables adaptive silence.

  • min_interval: the minimum interval between event notifications. Unit: seconds.

  • alert_type: the notification method. Valid values:

    • hdm_alarm_sms: text message.

    • dingtalk: DingTalk chatbot.

    • hdm_alarm_sms_and_email: text message and email.

    • hdm_alarm_sms,dingtalk: text message and DingTalk chatbot.

{"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:

  • 0: The event subscription feature is disabled.

  • 1: The event subscription feature is enabled.

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: text message.

  • dingtalk: DingTalk chatbot.

  • hdm_alarm_sms_and_email: text message and email.

  • hdm_alarm_sms,dingtalk: text message and DingTalk chatbot.

hdm_alarm_sms,dingtalk

level

string

The risk level of the events. Valid values:

  • Notice

  • Optimization

  • Warn

  • Critical

Optimization

Code

string

The HTTP status code.

200

Success

string

Whether the request was successful. Valid values:

  • true

  • false

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.