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 2023-05-06 GMT+08:00

Function

This API is used to query alarm records.

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 a 22-digit string consisting of letters and digits.

Minimum: 24

Maximum: 24

name

No

String

Specifies the alarm rule name.

Minimum: 0

Maximum: 128

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 the Namespace column.

Minimum: 3

Maximum: 32

resource_id

No

String

Specifies the alarm resource ID. If a 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 page size.

Minimum: 1

Maximum: 100

Default: 10

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

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Specifies the MIME type of a 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 histories.

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 severity of an alarm record. 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.

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

metric

Metric object

Specifies the metric information.

condition

AlarmCondition object

Specifies the alarm triggering condition.

additional_info

AdditionalInfo object

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

alarm_actions

Array of Notification objects

Specifies the 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, autoscaling, or notification_list. notification: indicates that a notification action will be triggered. autoscaling: indicates that a scaling action will be triggered. notification_list: When the alarm rule status changes, Cloud Eye will notify users in the notification list.

ok_actions

Array of Notification objects

Specifies the action to be triggered after the 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: indicates that a notification action will be triggered. notification_list: When the alarm rule status changes, Cloud Eye will notify users in the notification list.

data_points

Array of DataPointInfo objects

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

Table 6 Metric

Parameter

Type

Description

namespace

String

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

Minimum: 3

Maximum: 32

metric_name

String

Specifies the metric name of a resource. The name must start with a letter and contain only letters, digits, 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 Distribute Data Service (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.

Table 7 Dimension

Parameter

Type

Description

name

String

Resource dimension. For example, the dimension of an ECS is 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 instance 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 monitoring period of a metric, in seconds. The default value is 0. For example, for an event alarm, set this parameter to 0. 1 indicates the original monitoring period of the metric. For example, if the original period of an RDS metric is 60s, the Relational Database Service (RDS) metric is calculated every 60 seconds as a data point. For details about the original period of each cloud service metric, see the Namespace column. 300 indicates that the metric is calculated every 5 minutes as a data point.

Enumeration values:

  • 0

  • 1

  • 300

  • 1200

  • 3600

  • 14400

  • 86400

filter

String

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

Minimum: 1

Maximum: 10

Regex Pattern: ^(>|<|>=|<=|=)$

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 counts that the threshold is met.

Minimum: 1

Maximum: 100

suppress_duration

Integer

Specifies the alarm suppression time, in seconds. This field corresponds to the last field of 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 an alarm is generated when the condition is met. 300 indicates that an alarm is generated every 5 minutes after the alarm triggering condition is 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, which is the event generated by the resource, for example, ev16031292300990kKN8p17.

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.

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

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

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