Creating an Alarm Subscription
Function
This API is used to create an alarm subscription.
Calling Method
For details, see Calling APIs.
URI
POST /v2/{project_id}/alarm-subs
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. To obtain the value, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Definition Subscribed alarm name. Range N/A |
| enable | No | Integer | Definition Whether to enable subscription. Range N/A |
| alarm_level | No | String | Definition Alarm severity. Range N/A |
| notification_target | Yes | String | Definition Message topic address. Range N/A |
| notification_target_name | Yes | String | Definition Message topic name. Range N/A |
| notification_target_type | Yes | String | Definition: Message topic type Range: |
| time_zone | Yes | String | Definition Time zone. Range N/A |
| cluster_id | No | String | Definition Cluster ID. Range N/A |
| alarm_detail | No | String | Definition Fine-grained alarm details. The alarm ID and alarm severity are separated by colons (:), and alarms are separated by commas (,). If this field is not empty, the alarm_level field must be left empty. Range N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Alarm subscription ID. Range N/A |
| name | String | Definition Subscribed alarm name. Range N/A |
| enable | Integer | Definition Whether to enable subscription. Range N/A |
| alarm_level | String | Definition Alarm severity. Range N/A |
| project_id | String | Definition Project ID. Range N/A |
| name_space | String | Definition Service to which the alarm belongs. Range N/A |
| notification_target | String | Definition Message topic address. Range N/A |
| notification_target_name | String | Definition Message topic name. Range N/A |
| notification_target_type | String | Definition: Message topic type Range: |
| language | String | Definition Language. Range N/A |
| time_zone | String | Definition Time zone. Range N/A |
| cluster_id | String | Definition Cluster ID. Range N/A |
| alarm_details | Array of AlarmSubDetailResopnse objects | Definition Details about all subscribed alarms. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Alarm configuration ID. Range N/A |
| alarm_id | String | Definition Alarm definition ID. Range N/A |
| alarm_name | String | Definition Alarm name. Range N/A |
| name_space | String | Definition Service. Range N/A |
| alarm_level | String | Definition Alarm severity. Range N/A |
Example Requests
Create an alarm subscription named dws-test-12. (The alarm levels are urgent, important, and minor. The address is urn:smn:cn-north-7:4cf650fd46704908aa071b4df2453e1e:dws-test-nodelete. SMN topic is dws-test-nodelete.)
post https://{Endpoint}/v2/4cf650fd46704908aa071b4df2453e1e/alarm-subs
{
"name" : "dws-test-12",
"enable" : 1,
"alarm_level" : "urgent,important,minor",
"notification_target" : "urn:smn:cn-north-7:4cf650fd46704908aa071b4df2453e1e:dws-test-nodelete",
"notification_target_name" : "dws-test-nodelete",
"notification_target_type" : "SMN",
"time_zone" : "GMT+08:00",
"cluster_id" : "52e42b4f-90de-40c2-91f6-31d7728f6a32"
} Example Responses
Status code: 200
{
"id" : "273ce506-dad8-411c-92f9-be5004739b40",
"name" : "dws-test-12",
"enable" : 1,
"language" : "zh-cn",
"alarm_level" : "urgent,important,minor",
"project_id" : "4cf650fd46704908aa071b4df2453e1e",
"name_space" : "dws",
"notification_target" : "urn:smn:cn-north-7:4cf650fd46704908aa071b4df2453e1e:dws-test-nodelete",
"notification_target_name" : "dws-test-nodelete",
"notification_target_type" : "SMN",
"time_zone" : "GMT+08:00",
"cluster_id" : "52e42b4f-90de-40c2-91f6-31d7728f6a32",
"alarm_details" : [ {
"id" : "011ceecb-4c09-47b7-8b19-d3ebd03f1f67",
"alarm_id" : "DWS_2000000031",
"alarm_name" : "Active Session Usage in a DWS Cluster Exceeded Threshold",
"name_space" : "dws",
"alarm_level" : "important"
}, {
"id" : "2471e04b-b972-47d3-adbb-5500ddbb8f95",
"alarm_id" : "DWS_2500000001",
"alarm_name" : "Schema Usage of the DWS Cluster Exceeds the Threshold",
"name_space" : "dws",
"alarm_level" : "important"
} ]
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Alarm subscription created. |
| 400 | Request error. |
| 401 | Authentication failed. |
| 403 | You do not have required permissions. |
| 404 | No resources found. |
| 500 | Internal server error. |
| 503 | Service unavailable. |