Querying Alarm Rules of One Service in One-Click Monitoring
Function
This API is used to query alarm rules of one service in one-click monitoring.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
GET /v2/{project_id}/one-click-alarms/{one_click_alarm_id}/alarms
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Specifies the tenant ID. Minimum: 1 Maximum: 64 Regex Pattern: ^[a-zA-Z0-9-]{1,64}$ |
one_click_alarm_id |
Yes |
String |
Specifies the one-click monitoring ID for a service. Minimum: 1 Maximum: 64 |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-Type |
Yes |
String |
Specifies the MIME type of the request body. The default type is application/json; charset=UTF-8. Default: application/json; charset=UTF-8 Minimum: 1 Maximum: 64 |
X-Auth-Token |
Yes |
String |
Specifies the user token. Minimum: 1 Maximum: 16384 |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
alarms |
Array of alarms objects |
Specifies the alarm rule list. Array Length: 1 - 100 |
Parameter |
Type |
Description |
---|---|---|
alarm_id |
String |
Specifies the ID of an alarm rule, which starts with al and is followed by 22 characters, including letters and digits. |
name |
String |
Specifies the name of an alarm rule. The name can contain 1 to 128 characters, including only letters, digits, underscores (_), and hyphens (-). |
description |
String |
Provides supplementary information about an alarm rule. The description can contain 0 to 256 characters. |
namespace |
String |
Specifies the metric namespace. |
policies |
Array of Policy objects |
Specifies the alarm policy. Array Length: 1 - 100 |
resources |
Array of ResourcesInListResp objects |
Specifies the resource list. Associated resources can be obtained by calling the API for querying resources in an alarm rule. Array Length: 1 - 3000 |
type |
String |
Specifies the alarm rule type. |
enabled |
Boolean |
Specifies whether to generate alarms when the alarm triggering conditions are met. |
notification_enabled |
Boolean |
Specifies whether to enable the alarm notification. |
alarm_notifications |
Array of SMNAction objects |
Specifies the action to be triggered by an alarm. |
ok_notifications |
Array of SMNAction objects |
Specifies the action to be triggered after an alarm is cleared. |
notification_begin_time |
String |
Specifies the time when the alarm notification was enabled. |
notification_end_time |
String |
Specifies the time when the alarm notification was disabled. |
Parameter |
Type |
Description |
---|---|---|
alarm_policy_id |
String |
Specifies the alarm policy ID. |
metric_name |
String |
Specifies the metric name. |
period |
Integer |
Specifies how often to generate an alarm, in seconds. 1 indicates that alarms are generated based on raw data. When alarm_type is EVENT.SYS or EVENT.CUSTOM, the value may be 0. Enumeration values:
|
filter |
String |
Specifies the rollup method. |
comparison_operator |
String |
Specifies the operator of an alarm threshold. |
value |
Number |
Specifies the threshold. |
unit |
String |
Specifies the metric unit. |
count |
Integer |
Specifies the number of times that the alarm triggering conditions are met. |
suppress_duration |
Integer |
Specifies the suppression period, in seconds. 0 indicates that only one alarm is generated. Enumeration values:
|
level |
Integer |
Specifies the alarm severity, which can be 1 (critical), ** 2** (major), 3 (minor), or 4 (informational). |
enabled |
Boolean |
Specifies whether to enable one-click monitoring. |
Parameter |
Type |
Description |
---|---|---|
resource_group_id |
String |
Specifies the resource group ID. This parameter is available when the monitoring scope is resource groups. Regex Pattern: ^rg([a-z]|[A-Z]|[0-9]){22}$ |
resource_group_name |
String |
Specifies the resource group name. This parameter is available when the monitoring scope is resource groups. Minimum: 1 Maximum: 128 |
dimensions |
Array of MetricDimension objects |
Specifies the dimension. Array Length: 0 - 10000 |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Specifies the name of a metric dimension. Minimum: 1 Maximum: 32 Regex Pattern: ^([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_|-){1,32}$ |
value |
String |
Specifies the value of a metric dimension. Minimum: 0 Maximum: 256 Regex Pattern: ^((([a-z]|[A-Z]|[0-9]){1}([a-z]|[A-Z]|[0-9]|_|-)*)|){0,256}$ |
Parameter |
Type |
Description |
---|---|---|
type |
String |
Specifies the notification type. The value can be notification, autoscaling, groupwatch, ecsRecovery, contact, contactGroup, or iecAction. Enumeration values:
Regex Pattern: ^(notification|autoscaling|groupwatch|ecsRecovery|contact|contactGroup|iecAction)$ |
notification_list |
Array of strings |
Specifies the list of objects to be notified if the 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 left blank. If type is set to autoscaling, the value of notification_list must be left blank. Note: If alarm_action_enabled is set to true, alarm_actions, ok_actions, or both of them must be specified. If alarm_actions and ok_actions coexist, their notification_list values must be the same. Array Length: 0 - 20 |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the status codes customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Specifies the request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Specifies the request ID. Minimum: 0 Maximum: 256 |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the status codes customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Specifies the request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Specifies the request ID. Minimum: 0 Maximum: 256 |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the status codes customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Specifies the request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Specifies the request ID. Minimum: 0 Maximum: 256 |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the status codes customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Specifies the request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Specifies the request ID. Minimum: 0 Maximum: 256 |
Example Requests
None
Example Responses
Status code: 200
OK
{ "alarms" : [ { "alarm_id" : "al123232232341232132", "name" : "alarm1", "description" : "hello world", "namespace" : "SYS.ECS", "policies" : [ { "alarm_policy_id" : "alxdxxxdsw12321321", "metric_name" : "cpu_util", "period" : 0, "filter" : "max", "comparison_operator" : "", "value" : 1.7976931348623156E108, "unit" : "%", "count" : 100, "suppress_duration" : 0, "level" : 2, "enabled" : true } ], "resources" : [ { "dimensions" : [ { "name" : "string", "value" : "string" } ] } ], "type" : "EVENT.SYS", "enabled" : true, "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" } ] }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
400 |
Failed to verify parameters. |
401 |
Not authenticated. |
403 |
Authentication failed. |
500 |
Internal system error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot