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
Help Center/ Cloud Eye/ API Reference/ API V1/ Alarm Rules/ Modifying an Alarm Rule

Modifying an Alarm Rule

Updated on 2024-12-26 GMT+08:00

Function

This API is used to modify an alarm rule.

NOTE:

For API V1, only an alarm rule can be configured for a single resource. You are advised to use Batch Adding Resources to an Alarm Rule, Batch Deleting Resources from an Alarm Rule, and Modifying All Fields in an Alarm Policy to work with the console.

Debugging

You can debug the API in API Explorer which supports automatic authentication. API Explorer can automatically generate and debug example SDK code.

URI

PUT /V1.0/{project_id}/alarms/{alarm_id}

  • Parameter description
    Table 1 Parameter description

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Specifies the project ID.

    For details about how to obtain the project ID, see Obtaining a Project ID.

    alarm_id

    Yes

    Specifies the alarm rule ID.

  • Example
    PUT https://{Cloud Eye endpoint}/V1.0/{project_id}/alarms/{alarm_id}

Request

  • Request parameters
    Table 2 Parameter description

    Parameter

    Mandatory

    Type

    Description

    alarm_name

    No

    String

    Specifies the alarm rule name. Only letters, digits, underscores (_), and hyphens (-) are allowed.

    alarm_description

    No

    String

    Provides supplementary information about the alarm rule. Enter 0 to 256 characters.

    condition

    No

    Condition object

    Specifies the alarm policy set in the alarm rule.

    For details, see Table 3.

    alarm_action_enabled

    No

    Boolean

    Specifies whether to enable the action to be triggered by an alarm. The default value is true.

    NOTE:

    If you set alarm_action_enabled to true, you must specify either alarm_actions or ok_actions. If alarm_actions and ok_actions coexist, their notificationList must be the same.

    alarm_level

    No

    Integer

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

    alarm_type

    No

    String

    Specifies the alarm rule type. The following enumeration types are supported:

    EVENT.SYS: The alarm rule is created for system events.

    EVENT.CUSTOM: The alarm rule is created for custom events.

    RESOURCE_GROUP: The alarm rule is created for resource groups.

    alarm_actions

    No

    Array of objects

    Specifies the action to be triggered by an alarm. The structure is as follows: { "type": "notification","notificationList": ["urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd"] }

    Possible values of type are as follows:

    notification: indicates that a notification will be sent.

    autoscaling: indicates that a scaling action will be triggered.

    For details, see Table 4.

    insufficientdata_actions

    No

    Array of objects

    Specifies the action to be triggered by the alarm of insufficient data. (You do not need to configure this deprecated parameter.)

    For details, see Table 6.

    ok_actions

    No

    Array of objects

    Specifies the action to be triggered after the alarm is cleared.

    For details, see Table 5.

    Table 3 condition data structure description

    Parameter

    Mandatory

    Type

    Description

    period

    Yes

    Integer

    Specifies how often Cloud Eye aggregates data, which can be

    • 1: Cloud Eye performs no aggregation and displays raw data.
    • 300: Cloud Eye aggregates data every 5 minutes.
    • 1200: Cloud Eye aggregates data every 20 minutes.
    • 3600: Cloud Eye aggregates data every hour.
    • 14400: Cloud Eye aggregates data every 4 hours.
    • 86400: Cloud Eye aggregates data every 24 hours.

    filter

    Yes

    String

    Specifies the data rollup method, which can be

    • average: Cloud Eye calculates the average value of metric data within a rollup period.
    • max: Cloud Eye calculates the maximum value of metric data within a rollup period.
    • min: Cloud Eye calculates the minimum value of metric data within a rollup period.
    • sum: Cloud Eye calculates the sum of metric data within a rollup period.
    • variance: Cloud Eye calculates the variance value of metric data within a rollup period.

    comparison_operator

    Yes

    String

    Specifies the alarm threshold operator, which can be >, =, <, >=, or <=.

    value

    Yes

    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 ECS cpu_util to 80.

    unit

    No

    String

    Specifies the data unit. Enter up to 32 characters.

    count

    Yes

    Integer

    Specifies the number of consecutive occurrence times that the alarm policy was met. Supported range: 1 to 5

    suppress_duration

    No

    Integer

    Specifies the interval for triggering an alarm if the alarm persists. Possible intervals are as follows:

    0: Cloud Eye triggers the alarm only once.

    300: Cloud Eye triggers the alarm every 5 minutes.

    600: Cloud Eye triggers the alarm every 10 minutes.

    900: Cloud Eye triggers the alarm every 15 minutes.

    1800: Cloud Eye triggers the alarm every 30 minutes.

    3600: Cloud Eye triggers the alarm every hour.

    10800: Cloud Eye triggers the alarm every 3 hours.

    21600: Cloud Eye triggers the alarm every 6 hours.

    43200: Cloud Eye triggers the alarm every 12 hours.

    86400: Cloud Eye triggers the alarm every day.

    Table 4 alarm_actions data structure description

    Parameter

    Mandatory

    Type

    Description

    type

    Yes

    String

    Specifies the alarm notification type.
    • notification: indicates that a notification will be sent.
    • autoscaling: indicates that a scaling action will be triggered.

    notificationList

    Yes

    Array of strings

    Specifies the list of objects to be notified if the alarm status changes. You can add up to 5 object IDs. topicUrn can be obtained from SMN. For details, see Querying Topics.

    If you set type to notification, you must specify notificationList. If you set type to autoscaling, you must set notificationList to [].

    NOTE:
    • To make the Auto Scaling (AS) alarm rule take effect, you must bind the scaling policy. For details, see Creating an AS Policy.
    • If you set alarm_action_enabled to true, you must specify either alarm_actions or ok_actions. (You do not need to configure the deprecated parameter insufficientdata_actions.)
    • If alarm_actions and ok_actions coexist, their notificationList must be the same. (You do not need to configure the deprecated parameter insufficientdata_actions.)
    • The IDs in the list are strings.
    Table 5 ok_actions data structure description

    Parameter

    Mandatory

    Type

    Description

    type

    Yes

    String

    Specifies the notification type when an alarm is triggered.
    • notification: indicates that a notification will be sent.
    • autoscaling: indicates that a scaling action will be triggered.

    notificationList

    Yes

    Array of objects

    Specifies the list of objects to be notified if the alarm status changes. The list contains a maximum of 5 object IDs. topicUrn can be obtained from SMN. For details, see Querying Topics.

    NOTE:

    If you set alarm_action_enabled to true, you must specify either alarm_actions or ok_actions. (You do not need to configure the deprecated parameter insufficientdata_actions.)

    If alarm_actions and ok_actions coexist, their notificationList must be the same. (You do not need to configure the deprecated parameter insufficientdata_actions.)

    Table 6 insufficientdata_actions data structure description

    Parameter

    Mandatory

    Type

    Description

    type

    Yes

    String

    Specifies the notification type when an alarm is triggered.
    • notification: indicates that a notification will be sent.
    • autoscaling: indicates that a scaling action will be triggered.

    notificationList

    Yes

    Array of objects

    Specifies the list of objects to be notified if the alarm status changes. You can add up to 5 object IDs. topicUrn can be obtained from SMN. For details, see Querying Topics.

    NOTE:
    • If you set alarm_action_enabled to true, you must specify either alarm_actions or ok_actions. (You do not need to configure the deprecated parameter insufficientdata_actions.)
    • If alarm_actions and ok_actions coexist, their notificationList must be the same. (You do not need to configure the deprecated parameter insufficientdata_actions.)
    • The IDs in the list are strings.
  • Example request
    {
       "alarm_name": "alarm-update-test01",
       "alarm_description": "alarm-update-test01",
       "condition": {
           "comparison_operator": ">=",
           "count": 3,
           "filter": "average",
           "period": 1,
           "value": 95
       },
       "alarm_action_enabled": false,
       "alarm_level": 2
    }

Returned Values

  • Normal

    204

  • Abnormal

    Returned Value

    Description

    400 Bad Request

    Request error.

    401 Unauthorized

    The authentication information is not provided or is incorrect.

    403 Forbidden

    Access to the requested page is forbidden.

    408 Request Timeout

    The request timed out.

    429 Too Many Requests

    Concurrent requests are excessive.

    500 Internal Server Error

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

    503 Service Unavailable

    The service is currently unavailable.

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