Mengonfigurasi pengaturan langganan event untuk instans database.
Deskripsi operasi
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.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
hdm:SetEventSubscription |
update |
*All Resource
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
ID instans. |
rm-2ze8g2am97624**** |
| EventContext |
string |
No |
Skenario event yang didukung. Anda dapat menetapkan nilainya ke AllContext, yang menunjukkan bahwa semua skenario didukung. |
AllContext |
| Lang |
string |
No |
Bahasa notifikasi event. Anda dapat menetapkan nilainya ke zh-CN, yang menunjukkan bahwa notifikasi event dikirim dalam bahasa Mandarin. |
zh-CN |
| MinInterval |
string |
No |
Interval minimum antara notifikasi event berturut-turut. Unit: detik. |
60 |
| ContactName |
string |
No |
Nama kontak yang menerima notifikasi peringatan. Pisahkan beberapa nama dengan koma (,). |
Default contact |
| ChannelType |
string |
No |
Metode notifikasi. Nilai valid:
|
hdm_alarm_sms,dingtalk |
| ContactGroupName |
string |
No |
Nama kelompok kontak yang menerima notifikasi peringatan. Pisahkan beberapa nama dengan koma (,). |
Default contact group |
| Level |
string |
No |
Tingkat risiko event. Nilai valid:
Konten berikut menjelaskan event pada setiap tingkat secara terperinci:
|
Optimization |
| Active |
string |
No |
Apakah akan mengaktifkan fitur langganan event. Nilai valid:
|
1 |
| Severity |
string |
No |
Tingkat keparahan peringatan berdasarkan tipe event. Tentukan parameter ini dalam format berikut: Nilai valid tipe event:
Nilai valid tingkat keparahan peringatan:
|
{"AutoScale":"critical","SQLThrottle":"info","TimeSeriesAbnormal":"warning"} |
| DispatchRule |
string |
No |
Aturan notifikasi berdasarkan tipe event. Jika Anda mengosongkan parameter ini, nilai MinInterval dan ChannelType yang berlaku. Tentukan parameter ini dalam format berikut:
|
{"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"}} |
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| RequestId |
string |
The request ID. |
097F0C56-B252-515A-B602-FC56EF93EF8A |
| Message |
string |
The returned message. Catatan
If the request was successful, Successful is returned. If the request failed, an error message such as an error code is returned. |
Successful |
| Data |
object |
The detailed information. |
|
| userId |
string |
The user ID. |
1088760496**** |
| instanceId |
string |
The instance ID. |
rm-2ze8g2am97624**** |
| eventContext |
string |
The supported event scenarios. Only AllContext is returned for this parameter, which indicates that all scenarios are supported. |
AllContext |
| lang |
string |
The language of event notifications. Only zh-CN is returned for this parameter, which indicates that event notifications are sent in Chinese. |
zh_CN |
| active |
integer |
Indicates whether the event subscription feature is enabled. Valid values:
|
1 |
| minInterval |
integer |
The minimum interval between consecutive event notifications. Unit: seconds. |
60 |
| contactName |
string |
The name of the contact who receives alert notifications. Multiple names are separated by commas (,). |
Default contact |
| contactGroupName |
string |
The name of the contact group that receives alert notifications. 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 returned. |
200 |
| Success |
string |
Indicates whether the request was successful. Valid values:
|
true |
Contoh
Respons sukses
JSONformat
{
"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"
}
Kode kesalahan
|
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. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.