Updated on 2026-02-10 GMT+08:00

Querying Alarms

Function

Queries alarms from Cloud Eye.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    workspace:statistics:listAlarm

    List

    -

    -

    -

    ces:alarmHistory:list

URI

GET /v2/{project_id}/alarms

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

level

No

Integer

Alarm severity. The value can be 1 (critical), 2 (major), 3 (minor), or 4 (warning).

offset

No

Integer

Page offset.

limit

No

Integer

Number of records displayed on each page. The default value is 100.

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

alarm_histories

Array of AlarmHistoryItem objects

Alarm records.

count

Integer

Total number of alarm records.

Table 4 AlarmHistoryItem

Parameter

Type

Description

record_id

String

Alarm record.

alarm_id

String

Alarm rule ID.

name

String

Alarm rule name.

status

String

Status of the alarm record. The value can be ok, alarm, or invalid.

type

String

Alarm rule type. ALL_INSTANCE indicates alarm rules for metrics of all resources. RESOURCE_GROUP indicates alarm rules for metrics of resources in a resource group. MULTI_INSTANCE indicates alarm rules for metrics of specified resources. EVENT.SYS indicates alarm rules for system events. EVENT.CUSTOM indicates alarm rules for custom events. DNSHealthCheck indicates alarm rules for health checks.

level

Integer

Severity of the alarm record. The value can be 1 (critical), 2 (major), 3 (minor), or 4 (warning).

begin_time

String

Generation time (UTC).

metric

AlarmMetric object

Alarm metric information.

condition

AlarmCondition object

Alarm triggering condition.

additional_info

AdditionalInfo object

Additional field of an alarm record, which applies only to alarm records generated in event monitoring scenarios.

data_points

Array of DataPointInfo objects

Time when the resource monitoring data is reported and the monitoring data in the alarm record.

Table 5 AlarmMetric

Parameter

Type

Description

namespace

String

Namespace of the service to be queried.

metric_name

String

Metric name of the resource.

dimensions

Array of AlarmMetricDimension objects

Metric dimension. A maximum of four dimensions can be added.

Table 6 AlarmMetricDimension

Parameter

Type

Description

name

String

Resource dimension.

value

String

Resource dimension value.

Table 7 AlarmCondition

Parameter

Type

Description

period

Integer

Monitoring period of a metric, in second. The default value is 0. For an event alarm, set this parameter to 0. 1 indicates the original period of a metric. For example, if the original period of an RDS metric is 60 seconds, the interval between its data points is 60 seconds.

filter

String

Rollup method. The value can be average, min, max, or sum.

comparison_operator

String

Threshold symbol. The value can be >, <, >=, <=, =, !=, cycle_decrease, cycle_increase, or cycle_wave. cycle_decrease indicates the decrease compared with the last period; cycle_increase indicates the increase compared with the last period; cycle_wave indicates the increase or decrease compared with the last period.

value

Double

Alarm threshold.

unit

String

Data unit, which cannot exceed 32 characters.

count

Integer

Times.

suppress_duration

Integer

Alarm suppression time, in second. This parameter corresponds to the last field in the alarm policy when an alarm rule is created on the Cloud Eye console. This field is used to avoid frequent alarms. 0 indicates that the alarm is not suppressed and alarms are generated as long as the conditions are met. 300 indicates that an alarm is generated every 5 minutes as long as the alarm triggering conditions are met.

Table 8 AdditionalInfo

Parameter

Type

Description

resource_id

String

ID of the resource corresponding to the alarm record.

resource_name

String

Name of the resource corresponding to the alarm record.

event_id

String

Event monitoring ID corresponding to the alarm record, which is the event generated by the resource.

Table 9 DataPointInfo

Parameter

Type

Description

time

String

UTC time when the resource monitoring data of the alarm record is reported.

value

Double

Resource monitoring data of the alarm record at the time point.

Status code: 400

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 401

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

None

Example Responses

Status code: 200

Succeeded.

{
  "alarm_histories" : [ {
    "record_id" : "string",
    "alarm_id" : "al1603131199286dzxpqK3Ez",
    "name" : "alarm-test01",
    "status" : "alarm",
    "type" : "EVENT.SYS",
    "level" : 1,
    "begin_time" : 231025,
    "metric" : {
      "namespace" : "SYS.IES",
      "metric_name" : "cpu_util",
      "dimensions" : [ {
        "name" : "instance_id",
        "value" : "4270ff17-aba3-4138-89fa-820594c39755"
      } ]
    },
    "condition" : {
      "period" : 1,
      "filter" : "average",
      "comparison_operator" : "",
      "value" : 0,
      "unit" : "percent",
      "count" : 10,
      "suppress_duration" : 300
    },
    "additional_info" : {
      "resource_id" : "22d98f6c-16d2-4c2d-b424-50e79d82838f",
      "resource_name" : "ECS-Test01",
      "event_id" : "ev16031292300990kKN8p17J"
    },
    "data_points" : [ {
      "time" : "string",
      "value" : 7.019
    } ]
  } ],
  "count" : 0
}

Status Codes

Status Code

Description

200

Succeeded.

400

Invalid request from the client.

401

Authentication failed.

500

Internal error.

Error Codes

See Error Codes.