Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Querying Alarm Records

Updated on 2025-01-13 GMT+08:00

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

Specifies the tenant ID.

Minimum: 1

Maximum: 64

Regex Pattern: ^[a-zA-Z0-9-]{1,64}$

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

alarm_id

No

String

Specifies an alarm ID, which starts with al and is followed by 22 characters, including letters and digits.

Minimum: 24

Maximum: 24

record_id

No

String

Alarm record ID, which starts with ah and is followed by 22 characters, including letters and digits.

Minimum: 24

Maximum: 24

name

No

String

Specifies the alarm rule name.

Minimum: 0

Maximum: 128

alarm_type

No

String

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

Enumeration values:

  • event

  • metric

status

No

String

Specifies the alarm rule status. The value can be ok, alarm, or invalid.

Minimum: 0

Maximum: 64

Regex Pattern: ^(ok|alarm|invalid)$

level

No

Integer

Specifies the alarm severity, which can be 1 (critical), ** 2** (major), 3 (minor), or 4 (informational).

Minimum: 1

Maximum: 4

namespace

No

String

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

Minimum: 3

Maximum: 32

resource_id

No

String

Specifies the ID of a resource in an alarm rule. If the resource has multiple dimensions, the resource IDs are sorted in ascending alphabetical order and separated by commas (,).

Minimum: 0

Maximum: 2048

from

No

String

Specifies the start time for querying alarm records, for example, 2022-02-10T10:05:46+08:00.

Minimum: 0

Maximum: 64

to

No

String

Specifies the end time for querying alarm records, for example, 2022-02-10T10:05:47+08:00.

Minimum: 0

Maximum: 64

offset

No

Integer

Specifies the pagination offset.

Minimum: 0

Maximum: 999

Default: 0

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

limit

No

Integer

Specifies the number of records that will be displayed on each page.

Minimum: 1

Maximum: 100

Default: 100

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

order_by

No

String

Keyword for sorting alarms. 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). update_time is used by default.

Enumeration values:

  • first_alarm_time

  • update_time

  • alarm_level

  • record_id

Request Parameters

Table 3 Request header 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

Table 4 Response body parameters

Parameter

Type

Description

alarm_histories

Array of AlarmHistoryItemV2 objects

Specifies the alarm records.

Array Length: 0 - 100

count

Integer

Specifies the total number of alarm records.

Minimum: 0

Maximum: 2147483647

Table 5 AlarmHistoryItemV2

Parameter

Type

Description

record_id

String

Specifies the alarm record ID.

Minimum: 24

Maximum: 24

alarm_id

String

Specifies the alarm rule ID, for example, al1603131199286dzxpqK3Ez.

Minimum: 24

Maximum: 24

name

String

Specifies the alarm rule name, for example, alarm-test01.

Minimum: 1

Maximum: 128

status

String

Specifies the status of an alarm record. The value can be ok, alarm, or invalid.

Enumeration values:

  • ok

  • alarm

  • invalid

level

Integer

Specifies the alarm severity of alarm records. The value can be 1 (critical), 2 (major), 3 (minor), or 4 (informational).

Enumeration values:

  • 1

  • 2

  • 3

  • 4

type

String

Specifies the 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.

Enumeration values:

  • EVENT.SYS

  • EVENT.CUSTOM

  • DNSHealthCheck

  • RESOURCE_GROUP

  • MULTI_INSTANCE

  • ALL_INSTANCE

action_enabled

Boolean

Specifies whether to send a notification. The value can be true or false.

begin_time

String

Specifies when an alarm record is generated (UTC time).

end_time

String

Specifies when an alarm record becomes invalid (UTC time).

first_alarm_time

String

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

last_alarm_time

String

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

alarm_recovery_time

String

UTC time when the alarm was cleared.

metric

Metric object

Specifies the metric information.

condition

AlarmCondition object

Specifies the conditions for triggering an alarm.

additional_info

AdditionalInfo object

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

alarm_actions

Array of Notification objects

Action to be triggered by an alarm. The structure is as follows: {"type": "notification", "notification_list": ["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] }. type can be notification (a notification action), autoscaling (a scaling action), or notification_list (when the alarm rule status changes, Cloud Eye will notify users in the notification list).

Array Length: 0 - 10

ok_actions

Array of Notification objects

Action to be triggered after an alarm is cleared. The structure is as follows: {"type": "notification", "notification_list": ["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] }. type can be notification or notification_list. notification_list indicates that when the alarm rule status changes, Cloud Eye will notify users in the notification list. '

Array Length: 0 - 10

data_points

Array of DataPointInfo objects

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

Array Length: 0 - 2147483647

Table 6 Metric

Parameter

Type

Description

namespace

String

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

Minimum: 3

Maximum: 32

metric_name

String

Specifies the metric name of a resource. The name must start with a letter and contain only digits, letters, and underscores. The length ranges from 1 to 64 characters. For example, cpu_util of an ECS indicates the CPU usage of the ECS. mongo001_command_ps in DDS indicates the command execution frequency. For details about the metric name of each service, see Service metric name.

Minimum: 1

Maximum: 64

dimensions

Array of Dimension objects

Specifies the metric dimension. A maximum of four dimensions can be added.

Array Length: 0 - 4

Table 7 Dimension

Parameter

Type

Description

name

String

Specifies the dimension of a resource. For example, the dimension of an Elastic Cloud Server (ECS) can be instance_id. A maximum of four dimensions are supported. For the metric dimension of each resource, see Service metric dimension.

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

value

String

Specifies the value of a resource dimension, which is the resource ID, for example, 4270ff17-aba3-4138-89fa-820594c39755.

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

Table 8 AlarmCondition

Parameter

Type

Description

period

Integer

Specifies the rollup period of a metric, in seconds. The default value is 0. For an event alarm, set this parameter to 0. 1 indicates the original rollup period of a metric. For example, if the original rollup period of an RDS metric is 60s, its data point is calculated every 60 seconds. For details about the original rollup period of each cloud service metric, see Services Interconnected with Cloud Eye. 300 indicates that the metric rollup period is 5 minutes.

Enumeration values:

  • 0

  • 1

  • 300

  • 1200

  • 3600

  • 14400

  • 86400

filter

String

Specifies the rollup method. The value can be average, min, max, or sum.

Minimum: 1

Maximum: 15

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

comparison_operator

String

Specifies the 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, and cycle_wave indicates the increase or decrease compared with the last period.

Minimum: 1

Maximum: 10

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

value

Double

Specifies the alarm threshold. Supported range: 0 to Number. MAX_VALUE (1.7976931348623157e+108) For detailed thresholds, see the value range of each metric in the appendix. For example, you can set Elastic Cloud Server (ECS) cpu_util to 80.

Minimum: 0

Maximum: 1.174271E108

unit

String

Specifies the data unit. Enter up to 32 characters.

Minimum: 0

Maximum: 32

count

Integer

Specifies the number of times that the alarm triggering conditions are met.

Minimum: 1

Maximum: 180

suppress_duration

Integer

Specifies the alarm suppression time, in seconds. 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.

Enumeration values:

  • 0

  • 300

  • 600

  • 900

  • 1800

  • 3600

  • 10800

  • 21600

  • 43200

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

Table 9 AdditionalInfo

Parameter

Type

Description

resource_id

String

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

Minimum: 0

Maximum: 128

resource_name

String

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

Minimum: 0

Maximum: 128

event_id

String

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

Minimum: 24

Maximum: 24

Table 10 Notification

Parameter

Type

Description

type

String

Specifies the notification type. notification indicates that notifications are sent through Simple Message Notification (SMN).

Regex Pattern: ^(notification|autoscaling|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". When type is set to notification, notification_list cannot 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

Table 11 DataPointInfo

Parameter

Type

Description

time

String

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

Minimum: 1

Maximum: 64

value

Double

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

Minimum: 0

Maximum: 1.7976931348623157E308

Status code: 400

Table 12 Response body parameters

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

Table 13 Response body parameters

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

Querying 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",
    "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

Failed to verify parameters.

500

Internal system error.

Error Codes

See Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback