Help Center/ Cloud Eye/ API Reference/ API V2/ One-Click Monitoring/ Enabling One-Click Monitoring
Updated on 2025-10-30 GMT+08:00

Enabling One-Click Monitoring

Function

This API is used to enable one-click monitoring.

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:alarms:createOneClickAlarms

    Write

    -

    g:EnterpriseProjectId

    • ces:oneClickAlarms:post

    -

URI

POST /v2/{project_id}/one-click-alarms

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

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

No

String

Definition

MIME type of the request body.

Constraints:

None

Value range:

The value can contain 1 to 64 characters.

Default value:

The default type is application/json; charset=UTF-8.

X-Auth-Token

No

String

Definition

User token.

Constraints:

None

Value range:

The value can contain 1 to 16,384 characters.

Default value:

None

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

one_click_alarm_id

Yes

String

Definition

One-click monitoring rule ID.

Constraints

N/A

Range

The value allows only letters and digits and can contain 1 to 64 characters.

Default Value

N/A

dimension_names

Yes

DimensionNames object

Dimensions in metric and event alarm rules that have one-click monitoring enabled. One-click monitoring must be enabled for at least one type of alarm rules.

notification_enabled

Yes

Boolean

Definition

Whether to enable alarm notifications.

Constraints

N/A

Range

A boolean value.

  • true: enabled

  • false: disabled

Default Value

true

alarm_notifications

No

Array of Notification objects

Definition

Notification group or topic subscription for alarm notifications.

Constraints

N/A

Range

A maximum of 10 notification groups or topic subscriptions

Default Value

N/A

ok_notifications

No

Array of Notification objects

Definition

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

Constraints

N/A

Range

A maximum of 10 notification groups or topic subscriptions

Default Value

N/A

notification_begin_time

No

String

Definition

Time when alarm notifications were enabled.

Constraints

N/A

Range

The value allows 1 to 64 characters and can only contain digits and colons (:).

Default Value

N/A

notification_end_time

No

String

Definition

Time when alarm notifications were disabled.

Constraints

N/A

Range

The value allows 1 to 64 characters and can only contain digits and colons (:).

Default Value

N/A

effective_timezone

No

String

Definition

Time zone, for example, GMT-08:00, GMT+08:00, or GMT+0:00.

Constraints

N/A

Range

1 to 16 characters

Default Value

N/A

notification_manner

No

String

Notification mode, which can be NOTIFICATION_GROUP (notification groups), TOPIC_SUBSCRIPTION (topic subscriptions), or NOTIFICATION_POLICY (notification policies).

notification_policy_ids

No

Array of strings

Associated notification policy IDs.

is_reset

No

Boolean

Whether to reset the default policy of one-click monitoring.

enabled_alarm_ids

No

Array of strings

Definition

IDs of the one-click monitoring rules to be enabled. The default value is the IDs of all one-click monitoring rules of the service with one-click monitoring enabled.

Constraints

0 to 50 array elements

Range

N/A

Default Value

All one-click monitoring rules of the service.

one_click_update_alarms

No

Array of one_click_update_alarms objects

Parameters required when alarm policies and notifications need to be modified at the same time when one-click monitoring is enabled. Currently, you can only modify the notification policies.

Table 4 DimensionNames

Parameter

Mandatory

Type

Description

metric

Yes

Array of strings

Dimensions in metric alarm rules that have one-click monitoring enabled. One-click monitoring are disabled by default for unspecified dimensions.

event

Yes

Array of strings

Dimensions in event alarm rules that have one-click monitoring enabled. One-click monitoring are disabled by default for unspecified dimensions. "" indicates enable one-click monitoring for all dimensions.

Table 5 Notification

Parameter

Mandatory

Type

Description

type

Yes

String

Definition

Notification type.

Constraints

N/A

Range

The value can be:

  • notification: SMN notifications

  • contact: account contacts

  • contactGroup: notification groups

  • autoscaling: AS notifications. This value is used only for AS.

  • groupwatch: deprecated

  • ecsRecovery: deprecated

  • iecAction: This API has been deprecated and is not recommended.

Default Value

N/A

notification_list

Yes

Array of strings

Definition

Recipients to be notified of the alarm status changes. The value of topicUrn can be obtained from SMN. For details, see section "Querying Topics".

Constraints

If type is set to notification, the value of notificationList cannot be left blank. If type is set to autoscaling, the value of notification_list must be left blank. If notification_enabled is set to true, you must specify either alarm_notifications or ok_notifications. If both alarm_notifications and ok_notifications are specified, their notification_list values must be the same. A maximum of 20 recipients are allowed.

Table 6 one_click_update_alarms

Parameter

Mandatory

Type

Description

alarm_id

No

String

Definition

Alarm rule ID.

Constraints

N/A

Range

The value starts with al and is followed by 22 characters that may include letters, digits, or a combination of both.

Default Value

N/A

name

No

String

Definition

This field has been deprecated. Alarm 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

description

No

String

Definition

This field has been deprecated. Alarm description.

Constraints

N/A

Range

0 to 256 characters

Default Value

N/A

namespace

No

String

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

policies

No

Array of Policy objects

Alarm policies.

resources

No

Array<Array<Dimension>>

This field has been deprecated. Resource list. Associated resources can be obtained by calling the API for querying resources in an alarm rule.

type

No

String

Definition

This field has been deprecated. Alarm rule type.

Constraints

N/A

Range

The value can be:

  • ALL_INSTANCE: alarms for all resources

  • RESOURCE_GROUP: alarms for resource groups

  • MULTI_INSTANCE: alarms for specified resources

  • EVENT.SYS: system event alarms

  • EVENT.CUSTOM: custom event alarms

  • DNSHealthCheck: health check alarms

Default Value

N/A

enabled

No

Boolean

Definition

Whether to enable the alarm rule.

Constraints

N/A

Range

A boolean value.

  • true: enabled

  • false: disabled

Default Value

true

notification_enabled

No

Boolean

Definition

Whether to enable alarm notifications. Whether to enable alarm notifications for one-click monitoring is determined by the outer-layer parameter notification_enabled. The inner-layer parameter is discarded.

Constraints

N/A

Range

A boolean value, which can be:

  • true: enable

  • false: disable

Default Value

true

alarm_notifications

No

Array of Notification objects

Definition

Notification group or topic subscription for alarm notifications. Whether to enable alarm notifications for one-click monitoring is determined by the outer-layer parameter alarm_notifications. The inner-layer parameter is discarded.

Constraints

N/A

Range

A maximum of 10 notification groups or topic subscriptions can be configured.

Default Value

N/A

ok_notifications

No

Array of Notification objects

Definition

Information about the notification group or topic subscription when the alarm is cleared. Whether to enable alarm notifications for one-click monitoring is determined by the outer-layer parameter ok_notifications. The inner-layer parameter is discarded.

Constraints

N/A

Range

A maximum of 10 notification groups or topic subscriptions can be configured.

Default Value

N/A

notification_begin_time

No

String

Definition

Time when alarm notifications were enabled.

Constraints

N/A

Range

The value allows 1 to 64 characters and can only contain digits and colons (:).

Default Value

N/A

notification_end_time

No

String

Definition

Time when alarm notifications were disabled.

Constraints

N/A

Range

The value allows 1 to 64 characters and can only contain digits and colons (:).

Default Value

N/A

notification_manner

No

String

Definition

Notification method. NOTIFICATION_POLICY indicates notification policies, NOTIFICATION_GROUP indicates notification groups, and TOPIC_SUBSCRIPTION indicates topic subscriptions. Whether to enable alarm notifications for one-click monitoring is determined by the outer-layer parameter notification_manner. The inner-layer parameter is discarded.

Constraints

N/A

Range

The value can be NOTIFICATION_POLICY, NOTIFICATION_GROUP, or TOPIC_SUBSCRIPTION. It allows 1 to 64 characters.

Default Value

N/A

notification_policy_ids

No

Array of strings

Definition

Associated notification policy IDs. Whether to enable alarm notifications for one-click monitoring is determined by the outer-layer parameter notification_policy_ids. The inner-layer parameter is discarded.

Constraints

N/A

Range

^([a-z]|[A-Z]|[0-9]|-){2,64}$ The value contains 2 to 64 characters.

Default Value

N/A

Table 7 Policy

Parameter

Mandatory

Type

Description

metric_name

Yes

String

Definition

Metric name of a resource. For details about the metrics of each service, see Service Metric Names.

Constraints

N/A

Range

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

Default Value

N/A

period

Yes

Integer

Definition

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

Constraints

N/A

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.

Default Value

N/A

filter

Yes

String

Definition

Aggregation method.

Constraints

N/A

Range

average, variance, min, max, or sum

Default Value

N/A

comparison_operator

Yes

String

Definition

Threshold symbol.

Constraints

The threshold symbols for metric alarms are >, >=, <, <=, =, !=, cycle_decrease, cycle_increase, and cycle_wave. The threshold symbols for event alarms are >, >=, <, <=, =, and !=.

Range

The value can be >, <, >=, <=, =, !=, cycle_decrease, cycle_increase, or cycle_wave. cycle_decrease indicates the decrease relative to the last period; cycle_increase indicates the increase relative to the last period; cycle_wave indicates the increase or decrease relative to the last period.

Default Value

N/A

value

No

Number

Definition

Alarm threshold. For specific thresholds, see the value range of each metric in the appendix.

Constraints

If there is only one threshold, value and alarm_level are used in pairs. If there are both hierarchical_value and value, hierarchical_value is used.

Range

The value ranges from -1.7976931348623157e+108 to 1.7976931348623157e+108.

Default Value

N/A

hierarchical_value

No

HierarchicalValue object

Definition

Multi-level alarm threshold.

Constraints

If there are both hierarchical_value and value, hierarchical_value is used.

When you create or modify an alarm rule, you can set only one threshold in the following scenarios:

  1. The alarm type is Metric and the alarm policy is Trigger an alarm when all policies are met.

  2. The alarm type is Event.

unit

No

String

Definition

Data unit.

Constraints

N/A

Range

[0,32]

Default Value

N/A

count

Yes

Integer

Definition

Number of times that the alarm triggering conditions are met.

Constraints

N/A

Range

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.

Default Value

N/A

suppress_duration

No

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.

Constraints

N/A

Range

The value can be:

  • 0: In the immediate triggering scenario, 0 indicates that the alarm is not suppressed. In the accumulated triggering scenario, 0 indicates that the alarm is generated only once.

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

Default Value

N/A

level

No

Integer

Definition

Alarm severity.

Constraints

N/A

Range

The value can be: 1 (critical), ** 2** (major), 3 (minor), or 4 (warning)

Default Value

2

namespace

No

String

Definition

namespace and dimension_name need to be specified for cloud product-level rules. This is to specify the resources that the policies apply to. For details about the namespace of each service, see Service 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 (_). The value must contain 0 to 32 characters.

Default Value

N/A

dimension_name

No

String

Definition

Metric dimension name. For details, see Service Dimension Names. namespace and dimension_name need to be specified for cloud product-level rules. This is to specify the resources that the policies apply to.

Constraints

N/A

Range

A maximum of four dimensions are supported. Example: instance_id for single-dimension scenarios; instance_id,disk for multi-dimension scenarios.

Default Value

N/A

enabled

No

Boolean

Definition

Whether the alarm policy is enabled. The value can be true (enabled) or false (disabled).

Constraints

N/A

Range

N/A

Default Value

N/A

Table 8 HierarchicalValue

Parameter

Mandatory

Type

Description

critical

No

Double

Definition

Threshold for critical alarms.

Constraints

N/A

Range

[-1.7976931348623157e+108, 1.7976931348623157e+108]

Default Value

N/A

major

No

Double

Definition

Threshold for major alarms.

Constraints

N/A

Range

[-1.7976931348623157e+108, 1.7976931348623157e+108]

Default Value

N/A

minor

No

Double

Definition

Threshold for minor alarms.

Constraints

N/A

Range

[-1.7976931348623157e+108, 1.7976931348623157e+108]

Default Value

N/A

info

No

Double

Definition

Threshold for warnings.

Constraints

N/A

Range

[-1.7976931348623157e+108, 1.7976931348623157e+108]

Default Value

N/A

Table 9 Dimension

Parameter

Mandatory

Type

Description

name

Yes

String

Definition

Dimension of the resource. For example, the dimension of an ECS is instance_id. For details about the metric dimension name of each service resource, see Service Dimension Names.

Constraints

N/A

Range

The value must start with a letter and can only contain letters, digits, underscores (_), and hyphens (-).

Default Value

N/A

value

No

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

Response Parameters

Status code: 201

Table 10 Response body parameters

Parameter

Type

Description

one_click_alarm_id

String

Definition

One-click monitoring rule ID.

Constraints

N/A

Range

The value allows only letters and digits and can contain 1 to 64 characters.

Default Value

N/A

Status code: 400

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

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

error_msg

String

Request error message.

request_id

String

Request ID.

Status code: 401

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

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

error_msg

String

Request error message.

request_id

String

Request ID.

Status code: 403

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

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

error_msg

String

Request error message.

request_id

String

Request ID.

Status code: 500

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

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

error_msg

String

Request error message.

request_id

String

Request ID.

Example Requests

/v2/{project_id}/one-click-alarms

{
  "one_click_alarm_id" : "o1234567890123456789012",
  "dimension_names" : {
    "metric" : [ "disk", "instance_id" ],
    "event" : [ "resource_id" ]
  },
  "notification_enabled" : true,
  "alarm_notifications" : [ {
    "type" : "notification",
    "notification_list" : [ "urn:smn:123" ]
  } ],
  "ok_notifications" : [ {
    "type" : "notification",
    "notification_list" : [ "urn:smn:123" ]
  } ],
  "notification_begin_time" : "00:00",
  "notification_end_time" : "23:59",
  "notification_manner" : "NOTIFICATION_POLICY",
  "notification_policy_ids" : [ "np15563156337845e8A2Wv63" ]
}

Example Responses

Status code: 201

Created

{
  "one_click_alarm_id" : "o1234567890123456789012"
}

Status Codes

Status Code

Description

201

Created

400

Parameter verification failed.

401

Not authenticated.

403

Authentication failed.

500

Internal system error.

Error Codes

See Error Codes.