Help Center/ Cloud Eye/ API Reference/ API V2/ Alarm Records/ This API is used to query alarm records.
Updated on 2025-08-27 GMT+08:00

This API is used to query alarm records.

Function

This API is used to query alarm records.

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}/alarm-histories

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Tenant ID.

Constraints:

None

Value range:

Project ID, used to specify the project that an asset belongs to. You can query the assets of a project by project ID. You can obtain the project ID by calling an API or on the console. For details, see Obtaining a Project ID. The value must contain of 1 to 64 characters.

Default value:

None

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

alarm_id

No

Array of strings

Definition:

List of alarm IDs. Alarm ID. It starts with al and is followed by 22 characters, including letters or digits.

Constraints:

The list can contain a maximum of 50 alarm IDs.

record_id

No

String

Definition:

Alarm record ID.

Constraints:

None

Value range:

The value can contain 24 characters. It starts with ah and is followed by 22 characters, including letters or digits.

Default value:

None

Regex Pattern: ^ah([0-9A-Za-z]){22}$

name

No

String

Definition:

Alarm rule name.

Constraints:

None

Value range:

The value can contain a maximum of 128 characters.

Default value:

None

status

No

Array of strings

Definition:

Alarm rule statuses. The value can be ok, alarm, or invalid.

Constraints:

The list can contain a maximum of three elements.

Enumeration values:

  • ok

  • alarm

  • invalid

level

No

Integer

Definition:

Alarm severity.

Constraints:

None

Value range:

The value can be 1 (critical), ** 2** (major), 3 (minor), or 4 (informational).

Default value:

None

Value range:

1-4

namespace

No

String

Definition:

Namespace of a service. For details about the namespace of each service, see Service namespace.

Constraints:

None

Value range:

The value is in the service.item format. The values of service and item must be a string, starting with a letter and containing only digits (0–9), letters (case-insensitive), and underscores (_). The value must contain 3 to 32 characters.

Default value:

None

Regex Pattern: ^([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_)*.([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_)*$

resource_id

No

String

Definition:

Alarm resource ID.

Constraints:

None

Value range:

In the context of multiple dimensions, resource IDs are separated by commas (,) in ascending alphabetical order. The value can contain a maximum of 2,048 characters.

Default value:

None

Regex Pattern: ^([a-z]|[A-Z]|[0-9]|_|-|:|,|\*|\.|/|#|\(|\))+$

from

No

String

Definition:

Start time of the period during which alarm records are updated, for example, 2022-02-10T10:05:46+08:00.

Constraints:

None

Value range:

The value can contain a maximum of 64 characters.

Default value:

None

to

No

String

Definition:

End time of the period during which alarm records are updated, for example, 2022-02-10T10:05:47+08:00.

Constraints:

None

Value range:

The value can contain a maximum of 64 characters.

Default value:

None

alarm_type

No

String

Definition:

Alarm type.

Constraints:

None

Value range:

Enumerated value. The value can be event (querying event alarms) or metric (querying metric alarms).

Default value:

None

Enumeration values:

  • event

  • metric

create_time_from

No

String

Definition:

Start time for generating alarm records, for example, 2022-02-10T10:05:46+08:00.

Constraints:

None

Value range:

The value can contain a maximum of 64 characters.

Default value:

None

create_time_to

No

String

Definition:

End time of the period during which alarm records are created, for example, 2022-02-10T10:05:47+08:00.

Constraints:

None

Value range:

The value can contain a maximum of 64 characters.

Default value:

None

offset

No

Integer

Definition:

Pagination offset.

Constraints:

None

Value range:

The value is an integer from 0 to 1000000000.

Default value:

0

Value range:

0-1000000000

Default value:

0

limit

No

Integer

Definition:

Pagination offset.

Constraints:

None

Value range:

The value is an integer from 1 to 100.

Default value:

100

Value range:

1-100

Default value:

100

Regex Pattern: ^([1-9]|[1-9][0-9]|100)$

order_by

No

String

Definition:

Keyword for sorting alarms.

Constraints:

None

Value range:

Enumerated value. The value can be first_alarm_time (time for generating the alarm for the first time), update_time (alarm update time), alarm_level (alarm severity), or record_id (primary key of the table record).

Default value:

update_time

Enumeration values:

  • first_alarm_time

  • update_time

  • alarm_level

  • record_id

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

No

String

Definition

MIME type of the request body.

Constraints:

None

Value range:

The value can contain 1 to 64 characters.

Default value:

The default type is application/json; charset=UTF-8.

Default value:

application/json; charset=UTF-8

X-Auth-Token

No

String

Definition

User token.

Constraints:

None

Value range:

The value can contain 1 to 16,384 characters.

Default value:

None

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

alarm_histories

Array of AlarmHistoryItemV2 objects

Definition:

Alarm records.

count

Integer

Definition:

Total number of alarm records.

Value range:

None

Value range:

0-2147483647

Table 5 AlarmHistoryItemV2

Parameter

Type

Description

record_id

String

Definition:

Alarm record ID.

Value range:

The value can contain a maximum of 24 characters.

alarm_id

String

Definition:

Alarm rule ID, for example, al1603131199286dzxpqK3Ez.

Value range:

The value can contain a maximum of 24 characters.

name

String

Definition:

Alarm rule name, for example, alarm-test01.

Value range:

The value can contain 1 to 128 characters.

status

String

Definition:

Alarm record status.

Value range:

The value can be ok, alarm, invalid, or ok_manual.

ok indicates normal, alarm indicates an ongoing alarm, invalid indicates an invalid alarm, and ok_manual indicates manual recovery.

Enumeration values:

  • ok

  • alarm

  • invalid

  • ok_manual

level

Integer

Definition:

Alarm severity.

Value range:

The value can be 1 (critical), 2 (major), 3 (minor), and 4 (informational).

Enumeration values:

  • 1

  • 2

  • 3

  • 4

type

String

Definition:

Alarm rule type.

Value range:

Enumerated value. 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.

Enumeration values:

  • EVENT.SYS

  • EVENT.CUSTOM

  • DNSHealthCheck

  • RESOURCE_GROUP

  • MULTI_INSTANCE

  • ALL_INSTANCE

Regex Pattern: ^(EVENT.SYS|EVENT.CUSTOM|DNSHealthCheck|RESOURCE_GROUP|MULTI_INSTANCE|ALL_INSTANCE)$

action_enabled

Boolean

Definition:

Whether to send notifications.

Value range:

true: Notifications are sent.

false: Notifications are not sent.

begin_time

String

Definition:

UTC time when the alarm was generated.

Value range:

None

end_time

String

Definition:

Alarm end time (UTC time).

Value range:

None

first_alarm_time

String

Definition:

UTC time when the alarm was generated for the first time.

Value range:

None

last_alarm_time

String

Definition:

UTC time when the alarm was generated for the last time.

Value range:

None

alarm_recovery_time

String

Definition:

UTC time when the alarm was cleared.

Value range:

None

metric

metric object

Definition

Metric information.

condition

condition object

Definition:

Alarm triggering condition.

additional_info

AdditionalInfo object

Definition:

Additional field of an alarm record. This is only intended for alarm records generated in event monitoring.

alarm_actions

Array of alarm_actions objects

Definition:

Actions triggered by the alarm. The structure is as follows: { "type": "notification", "notification_list":

["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] }. The value of type can be:

notification: Notifications will be sent. autoscaling: A scaling action will be triggered.

notification_list: recipients to be notified of the alarm status changes.

ok_actions

Array of ok_actions objects

Definition:

Action to be triggered after an alarm is cleared. The structure is as follows: { "type": "notification", "notification_list":

["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] }.

The value of type can be notification or notification_list (recipients to be notified of the alarm status changes).

data_points

Array of DataPointInfo objects

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

Table 6 metric

Parameter

Type

Description

namespace

String

Definition:

Namespace of a service. For details about the namespace of each service, see Service namespace.

Value range:

The value can contain 3 to 32 characters.

metric_name

String

Definition:

Metric name of a resource. For example, the ECS metric cpu_util indicates the CPU usage of an ECS. The DDS metric mongo001_command_ps indicates the command execution frequency. For details about the metrics of each service, see Service metric name.

Value range:

The value can contain 1 to 64 characters.

dimensions

Array of dimensions objects

Definition:

Metric dimension.

Value range:

None

Table 7 dimensions

Parameter

Type

Description

name

String

Definition:

Dimension of a resource. For example, the dimension of an ECS can be instance_id. A maximum of four dimensions are supported. For the metric dimension of each resource, see Service metric dimension.

Value range:

The value can contain 1 to 32 characters.

Regex Pattern: ^([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_|-)*$

value

String

Definition:

Resource dimension value, which is an instance ID, for example, 4270ff17-aba3-4138-89fa-820594c39755.

Value range:

The value can contain 1 to 256 characters.

Regex Pattern: ^((([a-z]|[A-Z]|[0-9]|\*|_|/|#|\(|\)){1}([a-z]|[A-Z]|[0-9]|_|-|\.|\*|/|#|\(|\))*))$

Table 8 condition

Parameter

Type

Description

period

Integer

Definition:

Metric period, in seconds. For details about the original metric period for each cloud service, see Supported Services.

Value range:

0: default value. For example, this value can be used for event alarms.

1: original metric period. For example, if the original period of an RDS metric is 60s, the metric data is collected and calculated every 60s.

300: The metric data is collected and calculated every 5 minutes.

1200: The metric data is collected and calculated every 20 minutes.

3600: The metric data is collected and calculated every 60 minutes.

14400: The metric data is collected and calculated every 4 hours.

86400: The metric data is collected and calculated every day.

Enumeration values:

  • 0

  • 1

  • 300

  • 1200

  • 3600

  • 14400

  • 86400

filter

String

Definition:

Aggregation method.

Value range:

Enumerated value. The options are average, min, max, sum, tp99 (99th percentile), tp95 (95th percentile), and tp90 (90th percentile). The value can contain 1 to 15 characters.

Regex Pattern: ^(average|min|max|sum|tp99|tp95|tp90)$

comparison_operator

String

Definition:

Threshold symbol.

Value range:

Enumerated value. The value can be >, <, >=, <=, =, !=, cycle_decrease, cycle_increase, or cycle_wave. cycle_decrease indicates the decrease relative to the last period; cycle_increase indicates the increase relative to the last period; cycle_wave indicates the increase or decrease relative to the last period. The value can contain 1 to 10 characters.

Regex Pattern: ^(>|<|>=|<=|=|!=|cycle_decrease|cycle_increase|cycle_wave)$

value

Double

Definition:

Alarm threshold.

Value range:

For detailed thresholds, see the value range of each metric in the appendix. For example, you can set ECS cpu_util to 80 in Services Interconnected with Cloud Eye. The value ranges from 0 to 1.7976931348623157e+108.

Value range:

0-1.7976931348623156E108

unit

String

Definition:

Data unit.

Value range:

The value can contain a maximum of 32 characters.

count

Integer

Definition:

Number of consecutive alarm triggers.

Value range:

The value can contain 1 to 180 characters.

Value range:

1-180

suppress_duration

Integer

Definition:

Alarm suppression duration (alarm interval), in seconds. This parameter corresponds to the last field in the alarm policy when you create an alarm rule. This field is used to address the issue of frequent alarm occurrences.

Value range:

0: The alarm is not suppressed. An alarm is generated when the condition is met.

300: An alarm is generated every 5 minutes once the alarm triggering condition is met.

600: An alarm is generated every 10 minutes once the alarm triggering condition is met.

900: An alarm is generated every 15 minutes once the alarm triggering condition is met.

1800: An alarm is generated every 30 minutes once the alarm triggering condition is met.

3600: An alarm is generated every 60 minutes once the alarm triggering condition is met.

10800: An alarm is generated every 3 hours once the alarm triggering condition is met.

21600: An alarm is generated every 6 hours after the alarm triggering condition is met.

43200: An alarm is generated every 12 hours once the alarm triggering condition is met.

8600: An alarm is generated once every day once the alarm triggering condition is met.

Enumeration values:

  • 0

  • 300

  • 600

  • 900

  • 1800

  • 3600

  • 10800

  • 21600

  • 43200

  • 86400

Regex Pattern: ^(0|300|600|900|1800|3600|10800|21600|43200|86400)$

Table 9 AdditionalInfo

Parameter

Type

Description

resource_id

String

Definition:

Resource ID corresponding to the alarm record, for example, 22d98f6c-16d2-4c2d-b424-50e79d82838f.

Value range:

The value can contain a maximum of 128 characters.

resource_name

String

Definition:

Resource name corresponding to the alarm record, for example, ECS-Test01.

Value range:

The value can contain a maximum of 128 characters.

event_id

String

Definition:

ID of the event in the alarm record, for example, ev16031292300990kKN8p17J.

Value range:

The value can contain a maximum of 24 characters.

Table 10 alarm_actions

Parameter

Type

Description

type

String

Definition:

Notification type.

Value range:

Enumerated value. The value can be notification (SMN notifications), contact (account contacts), contactGroup (notification groups), or autoscaling (AS notifications). autoscaling is used only in AS and is not recommended. groupwatch, ecsRecovery, and iecAction are no longer used.

Enumeration values:

  • notification

  • autoscaling

  • groupwatch

  • ecsRecovery

  • contact

  • contactGroup

  • iecAction

notification_list

Array of strings

Definition:

Recipients to be notified of the alarm status changes. The value of topicUrn can be obtained from SMN. For details, see section "Querying Topics".

Table 11 ok_actions

Parameter

Type

Description

type

String

Definition:

Notification type.

Value range:

Enumerated value. The value can be notification (SMN notifications), contact (account contacts), contactGroup (notification groups), or autoscaling (AS notifications). autoscaling is used only in AS and is not recommended. groupwatch, ecsRecovery, and iecAction are no longer used.

Enumeration values:

  • notification

  • autoscaling

  • groupwatch

  • ecsRecovery

  • contact

  • contactGroup

  • iecAction

notification_list

Array of strings

Definition:

Recipients to be notified of the alarm status changes. The value of topicUrn can be obtained from SMN. For details, see section "Querying Topics".

Table 12 DataPointInfo

Parameter

Type

Description

time

String

Definition:

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

Value range:

The value can contain 1 to 64 characters.

value

Double

Definition:

Resource monitoring data of the alarm record at the time point, for example, 7.019.

Value range:

The value is an integer from 0 to 1.7976931348623157e+308.

Value range:

0-1.7976931348623157E308

Status code: 400

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Status codes customized by each cloud service when a request error occurs.

error_msg

String

Request error message.

request_id

String

Request ID.

Status code: 500

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

Status codes customized by each cloud service when a request error occurs.

error_msg

String

Request error message.

request_id

String

Request ID.

Example Requests

Alarm records whose alarm_name is alarm-test01, and from and to are 2022-02-10T10:05:46+08:00.

/v2/{project_id}/alarm-histories?limit=10&offset=0&from=2022-02-10T10:05:46+08:00&to=2022-02-10T12:05:46+08:00&alarm_name=alarm-test01

Example Responses

Status code: 200

Query succeeded.

{
  "alarm_histories" : [ {
    "alarm_id" : "al1604473987569z6n6nkpm1",
    "record_id" : "ah1655717086704DEnBrJ999",
    "name" : "TC_CES_FunctionBaseline_Alarm_008",
    "metric" : {
      "namespace" : "SYS.VPC",
      "dimensions" : [ {
        "name" : "bandwidth_id",
        "value" : "79a9cc0c-f626-4f15-bf99-a1f184107f88"
      } ],
      "metric_name" : "downstream_bandwidth"
    },
    "condition" : {
      "period" : 1,
      "filter" : "average",
      "comparison_operator" : ">=",
      "value" : 0,
      "count" : 3,
      "suppress_duration" : 3600
    },
    "level" : 2,
    "type" : "ALL_INSTANCE",
    "begin_time" : "2024-02-11T05:48:08+08:00",
    "end_time" : "2024-02-11T08:48:08+08:00",
    "last_alarm_time" : "2024-02-11T06:48:08+08:00",
    "alarm_recovery_time" : "2024-02-11T08:48:08+08:00",
    "action_enabled" : false,
    "alarm_actions" : [ ],
    "ok_actions" : [ ],
    "status" : "alarm",
    "data_points" : [ {
      "time" : "2022-06-22T16:38:02+08:00",
      "value" : 873.1507798960139
    }, {
      "time" : "2022-06-22T16:28:02+08:00",
      "value" : 883.1507798960139
    }, {
      "time" : "2022-06-22T16:18:02+08:00",
      "value" : 873.4
    } ],
    "additional_info" : {
      "resource_id" : "",
      "resource_name" : "",
      "event_id" : ""
    }
  } ],
  "count" : 103
}

Status Codes

Status Code

Description

200

Query succeeded.

400

Parameter verification failed.

500

Internal system error.

Error Codes

See Error Codes.