Help Center/ GaussDB/ API Reference/ APIs (Recommended)/ Homepage Overview/ Collecting Instance Alarm Statistics
Updated on 2025-10-20 GMT+08:00

Collecting Instance Alarm Statistics

Function

This API is used to collect statistics on instance alarms. Before calling this API:

Debugging

You can debug this API in API Explorer.

URI

GET /v3/{project_id}/instances/alarm-statistics

Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region.

To obtain the value, see Obtaining a Project ID.

Constraints

N/A

Range

The value can contain 32 characters. Only letters and digits are allowed.

Default Value

N/A

Table 2 Query parameters

Parameter

Mandatory

Type

Description

start_time

Yes

String

Definition

Query start time.

Constraints

Up to seven days of data can be collected.

Range

The value is in the yyyy-mm-ddThh:mm:ssZ format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, in the Beijing time zone, the time zone offset is shown as +0800.

Default Value

N/A

top_num

Yes

Integer

Definition

Number of instances with the most alarms.

Constraints

N/A

Range

The value must be greater than 0.

Default Value

5

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token.

You can obtain the token by calling the IAM API used to obtain a user token.

The value of X-Subject-Token in the response header is the token value.

Constraints

N/A

Range

N/A

Default Value

N/A

X-Language

No

String

Definition

Language.

Constraints

N/A

Range

  • zh-cn
  • en-us

Default Value

en-us

Response Parameters

Table 4 Response body parameters

Parameter

Type

Description

total_alarm_count

Integer

Definition

Total alarms.

Range

N/A

ring_percentage

Double

Definition

Period-over-period ratio.

Range

A value of 0 indicates no change compared to the previous period. A null value indicates that no alarm was triggered in the previous period.

instance_alarm_level_statistics

Array of InstanceAlarmLevelStatistic objects

Definition

Instance-level alarm statistics.

total_alarm_level_statistics

Array of AlarmLevelStatistics objects

Definition

All alarm statistics.

Table 5 InstanceAlarmLevelStatistic

Parameter

Type

Description

instance_id

String

Definition

Instance ID.

Range

The value can contain 36 characters. Only letters and digits are allowed.

instance_name

String

Definition

Instance name.

Range

N/A

total_count

Integer

Definition

Total alarms.

Range

N/A

alarm_level_statistics

Array of AlarmLevelStatistics objects

Definition

Instance-level alarm statistics by severity.

Table 6 AlarmLevelStatistics

Parameter

Type

Description

count

Integer

Definition

Number of alarms.

Range

N/A

level_name

String

Definition

Alarm severity name.

Range

  • critical
  • major
  • minor
  • notice

Example Request

Collecting alarm statistics

GET https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/9a29cc53af2f499cb48a6d81839264cb/instances/alarm-statistics?start_time=2022-06-22T16:38:02%2B0800&top_num=5

Example Response

{
  "total_alarm_count" : 99,
  "ring_percentage" : 0.2,
  "instance_alarm_level_statistics" : [ {
    "instance_id" : "d8e6ca5a624745bcb546a227aa3ae1cfin14",
    "instance_name" : "gauss_test",
    "total_count" : 50,
    "alarm_level_statistics" : [ {
      "count" : 5,
      "level_name" : "critical"
    }, {
      "count" : 45,
      "level_name" : "notice"
    } ]
  } ],
  "total_alarm_level_statistics" : [ {
    "count" : 5,
    "level_name" : "critical"
  }, {
    "count" : 94,
    "level_name" : "notice"
  } ]
}

Status Codes

Error Codes

For details, see Error Codes.