Help Center/ Cloud Eye/ API Reference/ API v2/ Alarm Templates/ Querying Alarm Templates
Updated on 2024-05-16 GMT+08:00

Querying Alarm Templates

Function

This API is used to query alarm templates.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

GET /v2/{project_id}/alarm-templates

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the tenant ID.

Minimum: 1

Maximum: 64

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Specifies the start position for pagination query, indicating the sequence number of the data record where the query starts. The default value is 0.

Minimum: 0

Maximum: 10000

limit

No

Integer

Specifies the maximum number of query results. The value ranges from 1 to 100 (default).

Minimum: 1

Maximum: 100

namespace

No

String

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

Minimum: 3

Maximum: 32

Regex Pattern: ^([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_)*\.([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_)*$

dim_name

No

String

Specifies the resource dimension, which must start with a letter. A dimension can contain up to 32 characters, including only digits, letters, underscores (_), and hyphens (-). Use commas (,) to separate multiple dimensions.

Minimum: 1

Maximum: 131

Regex Pattern: ^([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_|-){0,31}(,([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_|-){0,31}){0,3}$

template_type

No

String

Specifies the alarm template type. system indicates default alarm templates for metrics, custom indicates the custom alarm templates for metrics, system_event indicates default event templates, custom_event indicates the custom event templates, and system_custom_event indicates all default and custom event templates. If this parameter is not specified, all metric templates are returned.

Enumeration values:

  • system

  • custom

  • system_event

  • custom_event

  • system_custom_event

template_name

No

String

Specifies the name of an alarm template. The name must start with a letter and can contain 1 to 128 characters, including letters, digits, underscores (_), and hyphens (-). Fuzzy match is supported.

Minimum: 1

Maximum: 128

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

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the tenant token.

Minimum: 1

Maximum: 16384

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

alarm_templates

Array of AlarmTemplates objects

Specifies the alarm template list.

Array Length: 0 - 100

count

Integer

Specifies the total number of alarm templates.

Minimum: 0

Maximum: 9999999

Table 5 AlarmTemplates

Parameter

Type

Description

template_id

String

Specifies the ID of an alarm template. The ID starts with at and is followed by up to 64 characters, including letters and digits.

template_name

String

Specifies the name of an alarm template. The name must start with a letter and can contain 1 to 128 characters, including letters, digits, underscores (_), and hyphens (-).

template_type

String

Specifies the type of an alarm template. custom indicates custom alarm templates, and system indicates default alarm templates.

Enumeration values:

  • system

  • custom

create_time

String

Specifies the time when an alarm template was created.

template_description

String

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

Status code: 400

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

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

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

Querying alarm templates

/v2/{project_id}/alarm-templates?offset=0&limit=100

Example Responses

Status code: 200

OK

{
  "alarm_templates" : [ {
    "template_id" : "at1628592157541dB1klWgY6",
    "template_name" : "my_template",
    "template_type" : "custom",
    "create_time" : "2006-01-02T15:04:05.000Z",
    "template_description" : "hello world"
  } ],
  "count" : 100
}

Status Codes

Status Code

Description

200

OK

400

Failed to verify parameters.

401

Not authenticated.

403

Authentication failed.

500

Internal system error.

Error Codes

See Error Codes.