Reviewed-by: Ziuzko, Alevtina <alevtina.ziuzko@t-systems.com> Co-authored-by: qiujiandong1 <qiujiandong1@huawei.com> Co-committed-by: qiujiandong1 <qiujiandong1@huawei.com>
46 KiB
Enabling One-Click Monitoring
Function
This API is used to enable one-click monitoring.
URI
POST /v2/{project_id}/one-click-alarms
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. Minimum: 1 Maximum: 64 Regular expression matching: ^[a-zA-Z0-9-]{1,64}$ |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
Content-Type |
Yes |
String |
MIME type of the request body. The default value is application/json; charset=UTF-8. Default: application/json; charset=UTF-8 Minimum: 1 Maximum: 64 |
X-Auth-Token |
Yes |
String |
User token. It is a response to the API for obtaining a user token. This API is the only one that does not require authentication. After a response is returned, the value of X-Subject-Token in the response header is the token. Minimum: 1 Maximum: 16384 |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
one_click_alarm_id |
Yes |
String |
One-click monitoring ID. Minimum: 1 Maximum: 64 Regular expression matching: ^([a-z]|[A-Z]|[0-9]){1,64}$ |
dimension_name |
Yes |
DimensionNames object |
Dimensions in metric and event alarm rules that have one-click monitoring enabled. One-click monitoring must be enabled for at least one type of alarm rules. |
notification_enabled |
Yes |
Boolean |
Whether to enable alarm notifications. The value can be true (enabled) or false (disabled). |
alarm_notifications |
No |
Array of Notification objects |
Action to be triggered by the alarm. Array length: 0 to 10 |
ok_notifications |
No |
Array of Notification objects |
Action to be triggered after an alarm is cleared. Array length: 0 to 10 |
notification_begin_time |
No |
String |
Time when the alarm notification was enabled. Example: 09:00 Regular expression matching: ^([01][0-9]|2[0-3]):([0-5][0-9])$ |
notification_end_time |
No |
String |
Time when the alarm notification was disabled. Example: 12:00 Regular expression matching: ^([01][0-9]|2[0-3]):([0-5][0-9])$ |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
metric |
Yes |
Array of strings |
Dimensions in metric alarm rules that have one-click monitoring enabled. One-click monitoring are disabled by default for unspecified dimensions. You must specify either metric or event. Array length: 0 to 100 The value is a list of character strings. Each element contains 1 to 131 characters. Regular expression matching: ^([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_|-|,)*$
|
event |
Yes |
Array of strings |
Dimensions in event alarm rules that have one-click monitoring enabled. One-click monitoring are disabled by default for unspecified dimensions. "" indicates enable one-click monitoring for all dimensions. You must specify either metric or event. Array length: 0 to 100 The value is a list of character strings. Each element contains 0 to 131 characters. Regular expression matching: ^([a-z]|[A-Z]|[0-9]|_|-|,)*$ |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
type |
Yes |
String |
Notification type. The value can be: notification: topic subscriptions. Notifications are sent using SMN topics. contact: cloud account contacts. Notifications are sent using the mobile number and email address registered for your account. |
notification_list |
Yes |
Array of strings |
List of objects to be notified of alarm status changes. The value of topicUrn can be obtained from SMN. For details, see section Querying Topics. If type is set to notification, the value of notificationList cannot be empty. If type is set to autoscaling, the value of notificationList must be empty. If you set alarm_action_enabled to true, you must specify either alarm_actions or ok_actions. If alarm_actions and ok_actions coexist, their notificationList must be the same. Array length: 0 to 20 |
Response Parameters
Status code: 201
Parameter |
Type |
Description |
|---|---|---|
one_click_alarm_id |
String |
One-click monitoring ID. Minimum: 1 Maximum: 64 Regular expression matching: ^([a-z]|[A-Z]|[0-9]){1,64}$ |
Status code: 400
Parameter |
Type |
Description |
|---|---|---|
error_code |
String |
Status code customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Request ID. Minimum: 0 Maximum: 256 |
Status code: 401
Parameter |
Type |
Description |
|---|---|---|
error_code |
String |
Status code customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Request ID. Minimum: 0 Maximum: 256 |
Status code: 403
Parameter |
Type |
Description |
|---|---|---|
error_code |
String |
Status code customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Request ID. Minimum: 0 Maximum: 256 |
Status code: 500
Parameter |
Type |
Description |
|---|---|---|
error_code |
String |
Status code customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Request ID. Minimum: 0 Maximum: 256 |
Example Requests
{
"one_click_alarm_id" : "o1234567890123456789012",
"dimension_names" : {
"metric" : [ "disk", "instance_id" ],
"event" : [ "resource_id" ]
},
"notification_enabled" : true,
"alarm_notifications" : [ {
"type" : "notification",
"notification_list" : [ "urn:smn:123" ]
} ],
"ok_notifications" : [ {
"type" : "notification",
"notification_list" : [ "urn:smn:123" ]
} ],
"notification_begin_time" : "00:00",
"notification_end_time" : "23:59"
}
Example Responses
Status code: 201
Created
{
"one_click_alarm_id" : "o1234567890123456789012"
}
Status Codes
Status Code |
Description |
|---|---|
201 |
Created |
400 |
Parameter verification failed. |
401 |
Authentication failed. |
403 |
Authentication failed. |
500 |
Failed to complete the request because of an internal server error. |
Error Codes
See Error Codes.