Help Center/ Cloud Eye/ API Reference/ API V1/ Alarm Rules/ Querying Alarm History
Updated on 2025-11-20 GMT+08:00

Querying Alarm History

Function

This API is used to query the alarm history.

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

    ces:alarmHistory:list

    List

    -

    g:EnterpriseProjectId

    -

    -

URI

GET /V1.0/{project_id}/alarm-histories

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. It is 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 from the API or console. For details, see Obtaining a Project ID.

Constraints

N/A

Range

1 to 64 characters

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

group_id

No

String

Definition:

Information about the group that the current resource belongs to.

Constraints:

N/A

Range:

The value starts with rg and is followed by 22 characters of letters, digits, or a combination of both. It can contain a total of 24 characters.

Default Value:

N/A

alarm_id

No

String

Definition:

Alarm rule ID.

Constraints:

N/A

Range:

The value starts with al and is followed by 22 characters of letters, digits, or a combination of both. It can contain a total of 24 characters.

Default Value:

N/A

alarm_name

No

String

Definition:

Alarm rule name.

Constraints:

N/A

Range:

The value allows 1 to 128 characters and can only contain digits, letters, underscores (_), and hyphens (-).

Default Value:

N/A

alarm_status

No

String

Definition:

Alarm status.

Constraints:

N/A

Range:

The value can be:

  • ok: normal

  • alarm: active

  • insufficient_data: insufficient data

  • invalid: invalid

Default Value:

N/A

alarm_level

No

Integer

Definition:

Severity of the alarm record. The value can be 1, 2, 3, or 4.

Constraints:

N/A

Range:

The value can be:

  • 1: critical

  • 2: major

  • 3: minor

  • 4: warning

Default Value:

N/A

namespace

No

String

Definition

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

Constraints

N/A

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 (_). It must contain 3 to 32 characters.

Default Value

N/A

from

No

String

Definition:

Start time of a time range used for filtering traces by time (including the time the traces were imported). The value is a timestamp.

Constraints:

N/A

Range:

1 to 13 characters

Default Value:

N/A

to

No

String

Definition:

End time of a time range used for filtering traces by time (including the time the traces were imported). The value is a timestamp.

Constraints:

N/A

Range:

1 to 13 characters

Default Value:

N/A

start

No

String

Definition:

Start position for pagination query, indicating the sequence number of the data record where the query starts.

Constraints:

N/A

Range:

An integer greater than or equal to 0

Default Value:

0

limit

No

String

Definition:

Maximum number of records being queried.

Constraints:

N/A

Range:

[1,100]

Default Value:

100

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

No

String

Definition

MIME type of the request body.

Constraints

N/A

Range

1 to 64 characters

Default Value

Default value application/json; charset=UTF-8 is recommended. For APIs used to upload objects or images, the MIME type varies with the flow type.

X-Auth-Token

No

String

Definition

User token.

Constraints

N/A

Range

1 to 16,384 characters

Default Value

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

alarm_histories

Array of AlarmHistoryInfoResp objects

Definition:

Details about one or more alarm history records.

meta_data

MetaDataForAlarmHistoryResp object

Definition

Total number of returned alarm history records.

Table 5 AlarmHistoryInfoResp

Parameter

Type

Description

alarm_id

String

Definition:

Alarm rule ID, for example, al1603131199286dzxpqK3Ez.

Range:

24 characters

alarm_name

String

Definition:

Alarm rule name, for example, alarm-test01.

Range:

1 to 128 characters

alarm_description

String

Definition:

Alarm rule description.

Range:

0 to 256 characters

metric

MetricInfoResp object

Definition:

Metric information.

condition

ConditionResp object

Definition

Alarm policy configured in the alarm rule.

alarm_level

Integer

Definition:

Alarm severity.

Range:

The value can be:

  • 1: critical

  • 2: major

  • 3: minor

  • 4: warning

alarm_type

String

Definition:

Alarm rule type.

Range:

The value can be:

  • ALL_INSTANCE: alarms for metrics of all resources

  • RESOURCE_GROUP: alarms for metrics of resources in a resource group

  • MULTI_INSTANCE: alarm for metrics of specified resources

  • EVENT.SYS: system event alarms

  • EVENT.CUSTOM: custom event alarms

  • DNSHealthCheck: health check alarms

alarm_enabled

Boolean

Definition:

Whether the alarm rule is enabled.

Range:

The value can be:

  • true: enabled

  • false: disabled

alarm_action_enabled

Boolean

Definition:

Whether to send notifications.

Range:

The value can be:

  • true: Notifications will be sent.

  • false: Notifications will not be sent.

alarm_actions

Array of AlarmActionsResp objects

Definition

Action to be triggered by an alarm. A structure example is { "type": "notification", "notificationList": ["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] }. The type value can be notification (a notification action will be triggered) or autoscaling (a scaling action will be triggered). notificationList indicates the recipients to be notified of the alarm status changes.

ok_actions

Array of AlarmActionsResp objects

Definition

Action to be triggered after an alarm is cleared. A structure example is { "type": "notification", "notificationList": ["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] }. The type value is notification (a notification action will be triggered). notificationList indicates the recipients to be notified of the alarm status changes.

insufficientdata_actions

Array of AlarmActionsResp objects

Definition

Action triggered due to insufficient data. A structure example is { "type": "notification", "notificationList": ["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] } typeindicates that the alarm notification is triggered due to insufficient data and its value is notification. notificationList indicates IDs of the recipients for receiving alarm notifications triggered due to insufficient data.

update_time

Long

Definition:

Time when the alarm status changed. The value is a UNIX timestamp in milliseconds, for example, 1603131199000.

Range:

N/A

enterprise_project_id

String

Definition:

Enterprise project ID.

Range:

The value allows 36 characters. It can only contain lowercase letters, digits, hyphens (-), and underscores (_). You can customize an enterprise project ID. The value can also be 0 (default enterprise project ID) or all_granted_eps (all enterprise project IDs).

trigger_time

Long

Definition:

Time when the monitoring data of the alarm history was reported. The value is a UNIX timestamp in milliseconds, for example, 1603131199469.

Range:

N/A

alarm_status

String

Definition:

Alarm status.

Range:

The value can be:

  • ok: normal

  • alarm: active

  • insufficient_data: insufficient data

  • invalid: invalid

datapoints

Array of DataPointForAlarmHistoryResp objects

Definition:

An array of data about the time when the monitoring data of the alarm history is reported and the monitoring metric values that are calculated.

additional_info

AdditionalInfoResp object

Definition

Additional field of the alarm history, which applies only to the alarm history generated for event monitoring.

notification_manner

String

Definition

Notification method.

Range:

The value can be:

  • NOTIFICATION_POLICY: notification policies

  • NOTIFICATION_GROUP: notification groups

  • TOPIC_SUBSCRIPTION: topic subscriptions

Table 6 MetricInfoResp

Parameter

Type

Description

namespace

String

Metric namespace, which must be in the service.item format and contain 3 to 32 characters. service and item each must start with a letter and contain only letters, digits, and underscores (_). Note: This parameter can be empty when alarm_type is set to EVENT.SYS or EVENT.CUSTOM. For example, the ECS namespace is SYS.ECS, and the DDS namespace is SYS.DDS. For the namespace of each service, see Service Namespaces.

metric_name

String

Definition:

Metric ID. For example, if the metric of an ECS is CPU usage, metric_name is cpu_util. For details about the namespace of each service, see Service Namespaces.

Constraints:

N/A

Range:

The value must start with a letter and can only contain digits, letters, underscores (_), and hyphens (-). 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. It allows 1 to 96 characters.

Default Value:

N/A

dimensions

Array of MetricsDimension objects

Definition

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

Table 7 MetricsDimension

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 Dimensions.

Constraints

N/A

Range

The value starts with a letter and allows 1 to 32 characters. It can contain letters, digits, underscores (_), and hyphens (-).

Default Value

N/A

value

String

Definition

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

Constraints

N/A

Range

1 to 256 characters

Default Value

N/A

Table 8 ConditionResp

Parameter

Type

Description

comparison_operator

String

Definition

Operator of an alarm threshold.

Range

NOTE:
, =, <, >=, <=, or !=

count

Integer

Definition

Number of consecutive times that an alarm is triggered.

Range

The value ranges from 1 to 5. For event alarms, the value ranges from 1 to 100.

filter

String

Definition

Data aggregation method.

Range

The value can be:

  • average: average value

  • variance

  • min: minimum value

  • max: maximum value

  • sum

period

Integer

Definition

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

Range

The value can be:

  • 0: The alarm is triggered immediately for event scenarios only.

  • 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 hour.

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

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

unit

String

Definition

Data unit.

Range

0 to 32 characters

value

Number

Definition

Alarm threshold. 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.

Range

-1.7976931348623157e+108 to 1.7976931348623157e+108

suppress_duration

Integer

Definition

Alarm suppression duration, in seconds. This parameter corresponds to the last field in the alarm policy when you create an alarm rule. This field is used to mitigate frequent alarm occurrences.

Range

The value can be:

  • 0: A metric alarm is generated only once. An event alarm is not suppressed in the immediate triggering scenario, and is generated only once in the accumulated triggering scenario.

  • 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 once the alarm triggering condition is met.

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

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

Table 9 AlarmActionsResp

Parameter

Type

Description

[items]

Array of NotificationResp objects

Definition

Information about the notification group or topic subscription when an alarm is triggered.

Table 10 NotificationResp

Parameter

Type

Description

type

String

Definition

Alarm notification type.

Range

notification (SMN notifications) or autoscaling (AS notifications)

notificationList

Array of strings

Definition

Recipients to be notified of the alarm status changes.

Table 11 DataPointForAlarmHistoryResp

Parameter

Type

Description

time

Long

Definition

Time when the monitoring data of the alarm history is reported. It is a UNIX timestamp in milliseconds, for example, 1603131028000.

Range:

N/A

value

Double

Definition

Resource monitoring data of the alarm history at a specific time point, for example, 7.019.

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.

Table 12 AdditionalInfoResp

Parameter

Type

Description

resource_id

String

Definition

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

Range:

Max. 128 characters

resource_name

String

Definition

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

Range:

Max. 128 characters

event_id

String

Definition

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

Range:

24 characters

Table 13 MetaDataForAlarmHistoryResp

Parameter

Type

Description

total

Integer

Definition

Total number of returned alarm history records.

Range:

N/A

Status code: 400

Table 14 Response body parameters

Parameter

Type

Description

-

String

Request error.

Status code: 401

Table 15 Response body parameters

Parameter

Type

Description

-

String

The authentication information is not provided or is incorrect.

Status code: 403

Table 16 Response body parameters

Parameter

Type

Description

-

String

Access to the requested page is forbidden.

Status code: 408

Table 17 Response body parameters

Parameter

Type

Description

-

String

The request timed out.

Status code: 429

Table 18 Response body parameters

Parameter

Type

Description

-

String

Too many requests.

Status code: 500

Table 19 Response body parameters

Parameter

Type

Description

-

String

Failed to complete the request because of an internal service error.

Status code: 503

Table 20 Response body parameters

Parameter

Type

Description

-

String

The system is currently unavailable.

Example Requests

/V1.0/{project_id}/alarm-histories?limit=10&start=0&from=1602494921346&to=1603099721346&alarm_name=alarm-test01

Example Responses

Status code: 200

OK

{
  "alarm_histories" : [ {
    "alarm_id" : "al1604473987569z6n6nkpm1",
    "alarm_name" : "TC_CES_FunctionBaseline_Alarm_008",
    "alarm_description" : "",
    "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
    },
    "alarm_level" : 2,
    "alarm_type" : "",
    "alarm_enabled" : false,
    "alarm_action_enabled" : false,
    "alarm_actions" : [ ],
    "ok_actions" : [ ],
    "insufficientdata_actions" : [ ],
    "update_time" : 1604473988000,
    "enterprise_project_id" : "0",
    "trigger_time" : 1604473987607,
    "alarm_status" : "alarm",
    "datapoints" : [ {
      "time" : 1604473860000,
      "value" : 0
    }, {
      "time" : 1604473800000,
      "value" : 0
    }, {
      "time" : 1604473740000,
      "value" : 0
    } ],
    "additional_info" : {
      "resource_id" : "",
      "resource_name" : "",
      "event_id" : ""
    }
  }, {
    "alarm_id" : "al1604473978613MvlvlbVZD",
    "alarm_name" : "alarm_merge",
    "alarm_description" : "",
    "metric" : {
      "namespace" : "AGT.ECS",
      "dimensions" : [ {
        "name" : "instance_id",
        "value" : "22d98f6c-16d2-4c2d-b424-50e79d82838f"
      } ],
      "metric_name" : "load_average5"
    },
    "condition" : {
      "period" : 1,
      "filter" : "average",
      "comparison_operator" : ">=",
      "value" : 0,
      "count" : 3,
      "unit" : "%",
      "suppress_duration" : 600
    },
    "alarm_level" : 2,
    "alarm_type" : "RESOURCE_GROUP",
    "alarm_enabled" : false,
    "alarm_action_enabled" : false,
    "alarm_actions" : [ ],
    "ok_actions" : [ ],
    "insufficientdata_actions" : [ ],
    "update_time" : 1604473979000,
    "enterprise_project_id" : "0",
    "trigger_time" : 1604473979070,
    "alarm_status" : "insufficient_data",
    "datapoints" : [ ],
    "additional_info" : {
      "resource_id" : "",
      "resource_name" : "",
      "event_id" : ""
    }
  } ],
  "meta_data" : {
    "total" : 2
  }
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

408

Request Timeout

429

Too Many Requests

500

Internal Server Error

503

Service Unavailable

Error Codes

See Error Codes.