Files
doc-exports/docs/ces/api-ref/UpdateAlarmRulePolicies.html
qiujiandong1 e9265fb6b0 CES API Update -20250521 version
Reviewed-by: Ziuzko, Alevtina <alevtina.ziuzko@t-systems.com>
Co-authored-by: qiujiandong1 <qiujiandong1@huawei.com>
Co-committed-by: qiujiandong1 <qiujiandong1@huawei.com>
2025-12-05 10:48:24 +00:00

67 KiB

Modifying Policies in an Alarm Rule

Function

This API is used to modify alarm policies in an alarm rule.

URI

PUT /v2/{project_id}/alarms/{alarm_id}/policies

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

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

Minimum: 1

Maximum: 64

Regular expression matching: ^[a-zA-Z0-9-]{1,64}$

alarm_id

Yes

String

Alarm rule ID.

Regular expression matching: ^al([0-9A-Za-z]){22}$

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

No

String

MIME type of the request body. The default value is application/json; charset=UTF-8.

Default: application/json; charset=UTF-8

Minimum: 1

Maximum: 64

X-Auth-Token

No

String

User token. It is a response to the API for obtaining a user token. This API is the only one that does not require authentication. After a response is returned, the value of X-Subject-Token in the response header is the token.

Minimum: 1

Maximum: 16384

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

policies

Yes

Array of UpdatePolicy objects

Policy information.

Array length: 1 to 50

Table 4 UpdatePolicy

Parameter

Mandatory

Type

Description

metric_name

Yes

String

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

Regular expression matching: ^([A-Za-z]){1}([0-9A-Za-z]|_|-)*$

period

Yes

Integer

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

Minimum: 0

Maximum: 86400

The value can be:

  • 0

  • 1

  • 300

  • 1200

  • 3600

  • 14400

  • 86400

filter

Yes

String

Data aggregation method. The value can be:

  • average: average value of metric data within an aggregation period.
  • max: maximum value of metric data in an aggregation period.
  • min: minimum value of metric data within an aggregation period.
  • sum: sum of metric data within an aggregation period.
  • variance: variance value of metric data within an aggregation period.

comparison_operator

Yes

String

Operator of an alarm threshold.

Regular expression matching: ^(>|<|>=|<=|=|!=)$

value

No

Number

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.

Minimum: 0

Maximum: 1.7976931348623157e+108

unit

No

String

Data unit. The value can contain a maximum of 32 characters. You can set this parameter based on your service needs.

Minimum: 0

Maximum: 32

count

Yes

Integer

Number of times that the alarm triggering conditions are met. For event alarms, the value ranges from 1 to 180. For metric and website alarms, the value can be 1, 2, 3, 4, 5, 10, 15, 30, 60, 90, 120, or 180.

suppress_duration

No

Integer

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.

Minimum: 0

Maximum: 86400

The value can be:

  • 0

  • 300

  • 600

  • 900

  • 1800

  • 3600

  • 10800

  • 21600

  • 43200

  • 86400

level

No

Integer

Alarm severity, which can be 1 (critical), 2 (major), 3 (minor), or 4 (informational). The default value is 2.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

policies

Array of UpdatePolicy objects

Policy information.

Array length: 1 to 50

Table 6 UpdatePolicy

Parameter

Type

Description

metric_name

String

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

Regular expression matching: ^([A-Za-z]){1}([0-9A-Za-z]|_|-)*$

period

Integer

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

Minimum: 0

Maximum: 86400

The value can be:

  • 0

  • 1

  • 300

  • 1200

  • 3600

  • 14400

  • 86400

filter

String

Data aggregation method. The value can be:

  • average: average value of metric data within an aggregation period.
  • max: maximum value of metric data in an aggregation period.
  • min: minimum value of metric data within an aggregation period.
  • sum: sum of metric data within an aggregation period.
  • variance: variance value of metric data within an aggregation period.

comparison_operator

String

Operator of an alarm threshold.

Regular expression matching: ^(>|<|>=|<=|=|!=)$

value

Number

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.

Minimum: 0

Maximum: 1.7976931348623157e+108

unit

String

Data unit. The value can contain a maximum of 32 characters. You can set this parameter based on your service needs.

Minimum: 0

Maximum: 32

type

String

Alarm policy type. This parameter is left blank by default.

The value can be:

  • auto: dynamic threshold.

NOTE:

This parameter has been discarded. It has no impact on APIs. It is still retained in this document for compatibility with earlier versions.

count

Integer

Number of times that the alarm triggering conditions are met. For event alarms, the value ranges from 1 to 180. For metric and website alarms, the value can be 1, 2, 3, 4, 5, 10, 15, 30, 60, 90, 120, or 180.

suppress_duration

Integer

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.

Minimum: 0

Maximum: 86400

The value can be:

  • 0

  • 300

  • 600

  • 900

  • 1800

  • 3600

  • 10800

  • 21600

  • 43200

  • 86400

level

Integer

Alarm severity, which can be 1 (critical), 2 (major), 3 (minor), or 4 (informational). The default value is 2.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

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

Minimum: 0

Maximum: 256

error_msg

String

Request error message.

Minimum: 0

Maximum: 256

request_id

String

Request ID.

Minimum: 0

Maximum: 256

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

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

Minimum: 0

Maximum: 256

error_msg

String

Request error message.

Minimum: 0

Maximum: 256

request_id

String

Request ID.

Minimum: 0

Maximum: 256

Example Requests

Modifying an alarm policy whose metric_name is disk_device_read_bytes_rate

{
  "policies" : [ {
    "metric_name" : "disk_device_read_bytes_rate",
    "period" : 1,
    "filter" : "average",
    "comparison_operator" : ">",
    "value" : 75,
    "unit" : "byte/s",
    "count" : 3,
    "suppress_duration" : 10800,
    "level" : 2
  } ]
}

Example Responses

Status code: 200

Modification succeeded.

{
  "policies" : [ {
    "metric_name" : "disk_device_read_bytes_rate",
    "period" : 1,
    "filter" : "average",
    "comparison_operator" : ">",
    "value" : 75,
    "unit" : "byte/s",
    "count" : 3,
    "type" : "",
    "suppress_duration" : 10800,
    "level" : 2
  } ]
}

Status Codes

Status Code

Description

200

Modification succeeded.

400

Parameter verification failed.

500

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

Error Codes

See Error Codes.