Files
doc-exports/docs/ces/api-ref/ShowAlarmTemplate.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

57 KiB

Querying Details of an Alarm Template

Function

This API is used to query details of an alarm template.

URI

GET /v2/{project_id}/alarm-templates/{template_id}

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}$

template_id

Yes

String

ID of an alarm template. The ID starts with at and is followed by letters, digits, or a combination of both. The value can contain a maximum of 64 characters.

Minimum: 2

Maximum: 64

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

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

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

template_id

String

ID of an alarm template. The ID starts with at and is followed by letters, digits, or a combination of both. The value can contain a maximum of 64 characters.

template_name

String

Alarm template name. It must start with a letter and can contain letters, digits, underscores (_), hyphens (-), parentheses, and periods (.). Fuzzy match is supported.

Minimum: 1

Maximum: 128

Regular expression matching:

^([\u4E00-\u9FFF]|[a-z]|[A-Z]|[0-9]|_|-|\(|\)|\.|\s)+$

template_type

String

Type of an alarm template. custom indicates custom alarm templates, and system indicates default alarm templates.

The value can be:

  • system

  • custom

create_time

String

Time when an alarm template was created. The value is in the 2006-01-02T15:04:05.000Z format.

template_description

String

Supplementary information about an alarm template. The description can contain 0 to 256 characters and is left blank by default.

policies

Array of policies objects

Alarm policies in an alarm template.

Array length: 1 to 50

Table 4 policies

Parameter

Type

Description

namespace

String

Namespace of a service. For details about the namespace of each service, see Service Namespaces. The namespace must be in the service.item format and contain 3 to 32 characters. service and item must start with a letter and can contain only letters, digits, and underscores (_).

Minimum: 3

Maximum: 32

dimension_name

String

Resource dimension, which must start with a letter. A dimension allows a maximum of 32 characters can only contain digits, letters, underscores (_), and hyphens (-). If there are multiple dimensions, use commas (,) to separate them. DimensionName in event alarm templates must be left blank.

metric_name

String

Metric name of a resource. For details about the metrics of each service, see Service Metric Names. The value must start with a letter and can only contain digits, letters, underscores (_), and hyphens (-). It allows 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.

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

period

Integer

Interval (seconds) for checking whether the alarm rule conditions are met.

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.

Minimum: 0

Maximum: 2.34854258277383E108

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

count

Integer

Number of consecutive alarm triggering times. 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.

alarm_level

Integer

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

suppress_duration

Integer

Alarm suppression period, in seconds. When the period is 0, only one alarm is generated.

The value can be:

  • 0

  • 300

  • 600

  • 900

  • 1800

  • 3600

  • 10800

  • 21600

  • 43200

  • 86400

Status code: 400

Table 5 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: 401

Table 6 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: 403

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: 404

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

Status code: 500

Table 9 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

Querying details of an alarm template

/v2/{project_id}/alarm-templates/{template_id}

Example Responses

Status code: 200

OK

{
  "template_id" : "at1628592157541dB1klWgY6",
  "template_name" : "my_template",
  "template_type" : "custom",
  "create_time" : "2006-01-02T15:04:05.000Z",
  "template_description" : "hello world",
  "policies" : [ {
    "namespace" : "SYS.ECS",
    "dimension_name" : "instance_id",
    "metric_name" : "cpu_util",
    "period" : 300,
    "filter" : "sum",
    "comparison_operator" : ">",
    "value" : 2,
    "unit" : "bit/s",
    "count" : 2,
    "alarm_level" : 2,
    "suppress_duration" : 300
  } ]
}

Status Codes

Status Code

Description

200

OK

400

Parameter verification failed.

401

Authentication failed.

403

Authentication failed.

404

Resources not found.

500

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

Error Codes

See Error Codes.