Feature description
Queries the list of alert events.
Call instructions
Interface constraints
The caller must have the read permission for the alert feature.
Request path
GET /api/v2/alarm/alarms
Request parameters
body:
Name |
Type |
Required |
Example Value |
Description |
|---|---|---|---|---|
| page | Integer | No | 1 | The page number of the requested data. The value starts from 1. Default value: 1. |
| size | Integer | No | 10 | The size of the requested data. Default value: 10, maximum value: 200. |
| appType | String | No | OceanBase | The application type (source of the alert). Valid values: |
| scope | String | No | Cluster | The scope of the alert. Valid values: |
| level | Integer | No | 1 | The alert level [1~5]. The corresponding alert levels are: Down, Critical, Alert, Caution, and Info |
| status | String | No | Active | The alert status. Valid values: |
| activeAtStart | Datetime | No | 2020-11-11T11:12:13.127+08:00 | The start time when the alert is triggered. |
| activeAtEnd | Datetime | No | 2020-11-11T17:11:13.127+08:00 | The end time when the alert is triggered. |
| isSubscribedByMe | Boolean | No | true | Indicates whether the alert is subscribed by the user. |
| keyword | String | No | hello | The keyword for matching. |
Return result
Basic data structure
Parameter |
Type |
Description |
|---|---|---|
| data | Object | The requested data. |
| ├─ contents | Array | The list of alert events. For more information, see Alert event data structure. |
| ├─ page | Object | The pagination information. |
| ├─ totalElements | Integer | The total number of records. |
| ├─ totalPage | Integer | The total number of pages. |
| ├─ number | Integer | The current page number. |
| ├─ size | Integer | The size of the current page. |
| successful | Boolean | Indicates whether the request is successful. |
| timestamp | Datetime | The timestamp when the server completes the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | The HTTP status code that conforms to the HTTP status specification. |
| traceId | String | The Trace ID of the request, which is used to troubleshoot issues. |
| server | String | The address of the server that responds to the request. |
Alert event data structure
Parameter |
Type |
Description |
|---|---|---|
| id | Integer | The ID of the alert event. |
| appType | String | The application type (alert source). The value range: |
| alarmType | String | The type of the alert. |
| scope | String | The scope of the alert. The value range: |
| level | Integer | The alert level, which ranges from 1 to 5. The values 1 to 5 respectively correspond to: Down, Critical, Alert, Caution, and Info. |
| status | String | The alert status. The value range: |
| target | String | The target object of the alert event, which is generated based on the target template of the alert rule. |
| summary | String | The overview of the alert event, which is generated based on the overview template of the alert rule. |
| description | String | The details of the alert event, which is generated based on the details template of the alert rule. |
| activeAt | Datetime | The generation time of the alert event. |
| resolvedAt | Datetime | The elimination time of the alert event. |
| updatedAt | Datetime | The update time of the alert event. |
| labels | Object | The labels and values of the alert event. |
Example
Request example
GET /api/v2/alarm/alarms
Sample return
{
"data": {
"contents": [
{
"activeAt": "2023-04-25T10:04:17Z",
"alarmTarget": {
"appType": "OceanBase",
"excludeTargets": [],
"includeTargets": [
{
"cluster": {
"clusterId": 1,
"name": "TEST_CLUSTER",
"obClusterId": 12
},
"tenants": [
{
"name": "oracle",
"obTenantId": 1002,
"tenantId": 3
}
]
}
],
"scope": "Tenant"
},
"alarmTemplateId": 0,
"alarmType": "ob_tenant_exists_expired_xa_trans",
"appType": "OceanBase",
"description": "OceanBase cluster: TEST_CLUSTER, tenant: oracle, expired XA transactions exist. Session id: 0, Trans id: 10609937150880685421, trans create time: 2023-04-25T14:05:47.766+08:00, the max trans duration: 5 hours 27 mins 53.51 secs.",
"gmtCreate": "2023-04-25T10:04:17Z",
"gmtModified": "2023-04-25T11:34:17.39943Z",
"id": 3000024,
"labels": {
"alarm_active_at": "2023-04-25T10:04:17Z",
"alarm_description": "OceanBase cluster: TEST_CLUSTER, tenant: oracle, expired XA transactions exist. Session id: 0, Trans id: 10609937150880685421, trans create time: 2023-04-25T14:05:47.766+08:00, the max trans duration: 5 hours 27 mins 53.51 secs.",
"alarm_description_en_us": "OceanBase cluster: TEST_CLUSTER, tenant: oracle, expired XA transactions exist. Session id: 0, Trans id: 10609937150880685421, trans create time: 2023-04-25T14:05:47.766+08:00, the max trans duration: 5 hours 27 mins 53.51 secs.",
"alarm_description_zh_cn": "OceanBase cluster: TEST_CLUSTER, tenant: oracle, expired XA transactions exist. Session id: 0, Trans id: 10609937150880685421, trans create time: 2023-04-25T14:05:47.766+08:00, the max trans duration: 5 hours 27 mins 53.51 secs.",
"alarm_description_zh_tw": "OceanBase cluster: TEST_CLUSTER, tenant: oracle, expired XA transactions exist. Session id: 0, Trans id: 10609937150880685421, trans create time: 2023-04-25T14:05:47.766+08:00, the max trans duration: 5 hours 27 mins 53.51 secs.",
"alarm_evaluation_interval": "20",
"alarm_is_build_in_rule": "true",
"alarm_level": "2",
"alarm_name": "OceanBase tenant contains XA expired transaction",
"alarm_name_en_us": "OceanBase tenant contains XA expired transaction",
"alarm_name_zh_cn": "OceanBase tenant contains XA expired transaction",
"alarm_name_zh_tw": "OceanBase tenant contains XA expired transaction",
"alarm_scope": "Tenant",
"alarm_status": "Active",
"alarm_summary": "alarm_template_id=0:ob_cluster=TEST_CLUSTER-12:tenant_name=oracle:trans_hash=10609937150880685421 OceanBase tenant contains XA expired transaction",
"alarm_summary_en_us": "alarm_template_id=0:ob_cluster=TEST_CLUSTER-12:tenant_name=oracle:trans_hash=10609937150880685421 OceanBase tenant contains XA expired transaction",
"alarm_summary_zh_cn": "alarm_template_id=0:ob_cluster=TEST_CLUSTER-12:tenant_name=oracle:trans_hash=10609937150880685421 OceanBase tenant contains XA expired transaction",
"alarm_summary_zh_tw": "alarm_template_id=0:ob_cluster=TEST_CLUSTER-12:tenant_name=oracle:trans_hash=10609937150880685421 OceanBase tenant contains XA expired transaction",
"alarm_target": "alarm_template_id=0:ob_cluster=TEST_CLUSTER-12:tenant_name=oracle:trans_hash=10609937150880685421",
"alarm_template_id": "0",
"alarm_threshold": "1200",
"alarm_type": "ob_tenant_exists_expired_xa_trans",
"alarm_updated_at": "2023-04-25T11:34:17Z",
"app": "OceanBase",
"app_type": "OceanBase",
"cluster_id": "1",
"is_xa_trans": "1",
"message_type": "Alarm",
"metrics": "xa_trans_max_duration_seconds",
"ob_cluster": "TEST_CLUSTER",
"ob_cluster_id": "12",
"ob_cluster_name": "TEST_CLUSTER",
"ob_tenant": "oracle",
"ob_tenant_id": "1002",
"obregion": "TEST_CLUSTER",
"ocp_ip": "127.1",
"session_id": "0",
"sql_alarm_type": "trans_stat",
"tenant_id": "3",
"tenant_name": "oracle",
"trans_create_time": "2023-04-25T14:05:47.766+08:00",
"trans_hash": "10609937150880685421",
"trans_id": "{hash:10609937150880685421, inc:404115548, addr:\"xxx.xxx.xxx.xxx:2882\", t:1677651496056481}",
"trans_max_duration_seconds": "19673.51",
"trans_state": "pending",
"trans_state_name": "PENDING_TRANSACTION",
"trans_type": "xa",
"trans_type_name": "XA_TRANSACTION",
"value": "19673.51",
"value_en_us": "5 hours 27 mins 53.51 secs",
"value_shown": "5 hours 27 mins 53.51 secs",
"value_zh_cn": "5 hours 27 mins 53.51 secs",
"value_zh_tw": "5 hours 27 mins 53.51 secs",
"values": "19673.51",
"xa_trans_max_duration_seconds": "19673.51",
"xa_trans_max_duration_seconds_alarm_threshold": "1200",
"xa_trans_max_duration_seconds_value": "19673.51",
"xa_trans_max_duration_seconds_value_en_us": "5 hours 27 mins 53.51 secs",
"xa_trans_max_duration_seconds_value_zh_cn": "5 hours 27 mins 53.51 secs",
"xa_trans_max_duration_seconds_value_zh_tw": "5 hours 27 mins 53.51 secs"
},
"level": 2,
"messagePush": {
"configured": true,
"noSuccessCount": 0,
"successCount": 10
},
"name": "OceanBase tenant contains XA expired transaction",
"scope": "Tenant",
"status": "Active",
"statusUpdatedAt": "2023-04-25T10:04:17Z",
"summary": "alarm_template_id=0:ob_cluster=TEST_CLUSTER-12:tenant_name=oracle:trans_hash=10609937150880685421 OceanBase tenant contains XA expired transaction",
"target": "alarm_template_id=0:ob_cluster=TEST_CLUSTER-12:tenant_name=oracle:trans_hash=10609937150880685421",
"updatedAt": "2023-04-25T11:34:17Z"
}
],
"page": {
"number": 1,
"size": 10,
"totalElements": 1,
"totalPages": 1
}
},
"duration": 29,
"server": "xxxx",
"status": 200,
"successful": true,
"timestamp": "2023-04-25T19:36:56.705+08:00",
"traceId": "eba3a5bbd9b24f38"
}
