---
title: "获取告警历史 - 云平台 OCP V4.3.0 | OceanBase 文档中心"
description: 获取告警历史 功能说明 该接口用于获取告警历史。 调用说明 接口约束 调用者需要通过 OCP 应用服务鉴权。 请求路径 GET /api/v2/alarm/alarms/history 请求参数 body： 参数 类型 必选 示例值 描述 appType String 否 OceanBase 应用类别（告警来源），取…
---
切换语言

- 中文站 - 简体中文
- International - English
- 日本站 - 日本語

文档反馈![](https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*lJTmRZ61jSUAAAAAAAAAAAAADiGDAQ/original) 云平台 OCPV 4.3.0

# 获取告警历史

更新时间：2026-04-14 11:55:54

[编辑](https://github.com/oceanbase/ocp-doc/edit/V4.3.0/zh-CN/1900.reference-guide/200.api-reference/1000.alert/300.fetch-history-alarms.md)  

## 功能说明

该接口用于获取告警历史。

## 调用说明

### 接口约束

调用者需要通过 OCP 应用服务鉴权。

### 请求路径

`GET /api/v2/alarm/alarms/history`

### 请求参数

**body：**

| 参数 | 类型 | 必选 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| appType | String | 否 | OceanBase | 应用类别（告警来源），取值范围：   - OceanBase - OCP - OMS - OBProxy - Binlog - Log OBLB - OBDNS - ODP |
| scope | String | 否 | Cluster | 告警范围，取值范围：   - Cluster - Tenant - Host - Service - BinlogService - Arbitration - Backup - OceanBaseLog - OBProxyLog - HostLog |
| target | Array | 否 | alarm_template_id=0:ob_cluster=TEST_CLUSTER-12:tenant_name=oracle:trans_hash=10609937150880685421 | 告警目标对象，基于告警规则的目标模板生成。 |
| alarmType | String | 否 | ob_tenant_exists_expired_xa_trans | 告警类型。 |
| level | Array | 否 | 1 | 告警等级 [1~5] ，分别对应：Down、Critical、Alert、Caution、Info |
| alarmGroupIds | integer | 否 | [1,2,3] | 告警分组的 ID 列表，多个 ID 用英文逗号分隔。 |
| status | Array | 否 | Active | 告警状态，取值范围：   - Active - Inactive - Silenced - Inhibited |
| activeAtStart | String | 否 | 2020-11-11T11:12:13.127+08:00 | 告警触发起始时间。 |
| activeAtEnd | String | 否 | 2020-11-11T17:11:13.127+08:00 | 告警触发截止时间。 |
| keyword | String | 否 | hello | 关键字匹配。 |

### 返回结果

**基础数据结构**

| 参数 | 类型 | 说明 |
| --- | --- | --- |
| data | Object | 请求的数据。 |
| ├─ contents | Array | 告警详情信息，详情参见 **OcpAlarm 数据结构**。 |
| ├─ page | Object | 分页信息，详情参见 **page 数据结构**。 |
| successful | Boolean | 请求是否成功。 |
| timestamp | Datetime | 服务端完成请求的时间戳。 |
| duration | Integer | 服务端处理请求的时间（毫秒）。 |
| status | Integer | 符合 HTTP Status 规范的编码。 |
| traceId | String | 请求的 Trace ID，用于排查问题。 |
| server | String | 响应请求的应用服务的地址。 |

**OcpAlarm 数据结构**

| 参数 | 类型 | 说明 |
| --- | --- | --- |
| gmtCreate | String | 创建时间。 |
| gmtModified | String | 修改时间。 |
| id | Integer | 告警事件 ID。 |
| alarmId | Integer | 告警 ID。 |
| alarmTemplateId | Integer | 告警模板 ID。 |
| appType | String | 应用类型，取值范围：   - OceanBase - OCP - OMS - OBProxy - Binlog - Log OBLB - OBDNS - ODP |
| alarmType | String | 告警类型。 |
| scope | String | 告警范围，取值范围：   - Cluster - Tenant - Host - Service - BinlogService - Arbitration - Backup - OceanBaseLog - OBProxyLog - HostLog |
| level | Integer | 告警等级 [1~5] ，分别对应：Down、Critical、Alert、Caution、Info。 |
| status | String | 告警状态，取值范围：   - Active - Inactive - Silenced - Inhibited |
| target | String | 告警目标对象，基于告警规则的目标模板生成。 |
| alarmTarget | Object | 告警对象信息，详情参见 **AlarmTarget 数据结构**。 |
| obCluster | Object | 集群相关信息，详情参见 **AlarmTarget 数据结构**。 |
| name | String | 告警名。 |
| summary | String | 告警概述，基于告警规则的概述模板生成。 |
| description | String | 告警详情，基于告警规则的详情模板生成。 |
| activeAt | String | 告警生成时间。 |
| resolvedAt | String | 告警消除时间。 |
| updatedAt | String | 告警更新时间。 |
| statusUpdatedAt | String | 告警状态更新时间。 |
| labels | Object | 告警事件的标签和值。 |
| targetLabels | Object | 告警对象的标签和值，如 `svr_ip`、`ob_tenant_id` 等。 |
| metricGroup | Object | 指标分组的数组，详情参见 **MetricGroup 数据结构**。 |
| messagePush | Object | 告警推送详情，详情参见 **MessagePush 数据结构**。 |
| alarmGroups | Array | 告警分组列表。 |
| originalAlarmId | Integer | 原告警 ID。 |
| containSnapshot | Boolean | 是否包含异常快照。 |
| containSelfcure | Boolean | 是否包含自愈。 |
| resolveComment | String | 解决告警的备注信息。 |

**AlarmTarget 数据结构**

| 参数 | 类型 | 说明 |
| --- | --- | --- |
| appType | String | 应用类型，取值范围：   - OceanBase - OCP - OMS - OBProxy - Binlog - Log OBLB - OBDNS - ODP |
| scope | String | 告警范围，取值范围：   - Cluster - Tenant - Host - Service - BinlogService - Arbitration - Backup - OceanBaseLog - OBProxyLog - HostLog |
| includeTargets | Array | 告警对象（正向选择）。 |
| excludeTargets | Array | 排除告警对象（反向选择）。 |

**MetricGroup 数据结构**

| 参数 | 类型 | 说明 |
| --- | --- | --- |
| id | Integer | 指标分组的 ID。 |
| key | String | 指标分组的编码名称。 |
| className | String | 指标分组对应的类名。 |
| name | String | 指标分组的名称，支持国际化。 |
| description | String | 指标分组的说明信息，支持国际化。 |
| metrics | Array | 指标元数据的数组。 |
| dimension | String | 指标分组的维度。 |
| withLabel | Boolean | 是否为带标签的监控数据群组，默认为 `false`。 |
| order | Integer | 排序参数。 |

**MessagePush 数据结构**

| 参数 | 类型 | 说明 |
| --- | --- | --- |
| configured | Boolean | 是否配置告警推送。 |
| successCount | Integer | 推送消息成功次数。 |
| noSuccessCount | Integer | 推送消息未成功次数。 |

**page 数据结构**

| 参数 | 类型 | 说明 |
| --- | --- | --- |
| totalElements | Integer | 总记录数。 |
| totalPage | Integer | 总页数。 |
| number | Integer | 当前页码。 |
| size | Integer | 当前页包含的记录条数。 |

## 示例

### 请求示例

`GET /api/v2/alarm/alarms/history`

### 返回示例

```JSON
{
    "data": {
        "contents": [{
            "activeAt": "2025-06-06T05:36:51Z",
            "alarmGroups": ["数据库内核"],
            "alarmId": 186,
            "alarmTarget": {
                "appType": "OceanBase",
                "excludeTargets": [],
                "includeTargets": [{
                    "cluster": {
                        "clusterId": 4,
                        "name": "ob3245_ps",
                        "obClusterId": 1731295860
                    },
                    "hosts": [{
                        "hostId": 5,
                        "hostIp": "xx.xx.xx.xx",
                        "id": 5
                    }]
                }],
                "scope": "Host"
            },
            "alarmTemplateId": 0,
            "alarmType": "observer_process_stop",
            "appType": "OceanBase",
            "autoResolved": true,
            "containSelfcure": false,
            "description": "集群：ob3245_ps，主机：xx.xx.xx.xx，告警：OBServer 进程停止。",
            "gmtCreate": "2025-06-06T05:36:51Z",
            "gmtModified": "2025-06-06T05:41:54.686997Z",
            "id": 186,
            "labels": {
                "app_type": "OceanBase",
                "alarm_threshold": "0",
                "svr_ip": "xx.xx.xx.xx",
                "value_zh_tw": "20245 天 5 小 時 35 分 40 秒",
                "alarm_status_native": "Active",
                "ob_cluster_type_shown": "主",
                "observer_boot_time_delta_seconds_value_zh_cn": "20245 天 5 小时 35 分 40 秒",
                "alarm_level": "2",
                "obregion": "ob3245_ps",
                "app_native": "OB",
                "alarm_summary_zh_tw": "alarm_template_id=0:ob_cluster=ob3245_ps-1731295860:host=xx.xx.xx.xx OBServer 進程停止",
                "alarm_summary_en_us": "alarm_template_id=0:ob_cluster=ob3245_ps-1731295860:host=xx.xx.xx.xx OBServer process stopped",
                "alarm_type": "observer_process_stop",
                "alarm_status": "Active",
                "alarm_group_zh_tw": "數據庫內核",
                "host": "xx.xx.xx.xx",
                "alarm_scope": "Host",
                "alarm_scope_native": "Host",
                "ob_cluster": "ob3245_ps",
                "alarm_description_zh_tw": "集群：ob3245_ps，伺服器：xx.xx.xx.xx，警示：OBServer 進程停止。",
                "value_en_us": "20245 days 5 hours 35 mins 40 secs",
                "observer_boot_time_delta_seconds_value_en_us": "20245 days 5 hours 35 mins 40 secs",
                "app": "OB",
                "__ob_cluster.id": "4",
                "contain_selfcure": "0",
                "observer_boot_time_delta_seconds_value_zh_tw": "20245 天 5 小時 35 分 40 秒",
                "level": "2",
                "related_svr_ips": "xx.xx.xx.xx",
                "alarm_name_en_us": "OBServer process stopped",
                "message_type": "Alarm",
                "alarm_status_zh_cn": "告警中",
                "alarm_scope_zh_tw": "主機",
                "alarm_group_en_us": "dba",
                "value_zh_cn": "20245 天 5 小时 35 分 40 秒",
                "alarm_description_en_us": "OceanBase cluster: ob3245_ps, host: xx.xx.xx.xx, alert: OBServer process stopped.",
                "__host.id": "5",
                "alarm_scope_zh_cn": "主机",
                "alarm_level_zh_cn": "严重",
                "ob_cluster_type": "PRIMARY",
                "alarm_summary_zh_cn": "alarm_template_id=0:ob_cluster=ob3245_ps-1731295860:host=xx.xx.xx.xx OBServer 进程停止",
                "ob_cluster_type_zh_tw": "主",
                "alarm_description": "集群：ob3245_ps，主机：xx.xx.xx.xx，告警：OBServer 进程停止。",
                "ob_cluster_type_native": "PRIMARY",
                "app_zh_tw": "OceanBase",
                "metrics": "observer_boot_time_delta_seconds",
                "ocp_ip": "xx.xx.xx.xx",
                "value_shown": "20245 天 5 小时 35 分 40 秒",
                "alarm_name": "OBServer 进程停止",
                "alarm_status_zh_tw": "警示中",
                "vpc_name": "system-default",
                "related_tenant_names": "sys,mysql,oracle",
                "values": "1749188140",
                "alarm_level_zh_tw": "嚴重",
                "alarm_level_native": "2",
                "alarm_scope_en_us": "Host",
                "app_zh_cn": "OceanBase",
                "alarm_level_en_us": "Critical",
                "ob_cluster_type_en_us": "Primary",
                "auto_resolved": "1",
                "alarm_summary": "alarm_template_id=0:ob_cluster=ob3245_ps-1731295860:host=xx.xx.xx.xx OBServer 进程停止",
                "alarm_active_at": "2025-06-06T13:36:51.231+08:00",
                "alarm_target": "alarm_template_id=0:ob_cluster=ob3245_ps-1731295860:host=xx.xx.xx.xx",
                "app_en_us": "OceanBase",
                "value": "1749188140",
                "alarm_name_zh_tw": "OBServer 進程停止",
                "ob_cluster_type_zh_cn": "主",
                "observer_boot_time_delta_seconds_value": "1749188140",
                "__ob_server.id": "5",
                "host_ip": "xx.xx.xx.xx",
                "related_ob_cluster_name": "ob3245_ps",
                "ob_cluster_name": "ob3245_ps",
                "alarm_name_zh_cn": "OBServer 进程停止",
                "alarm_status_en_us": "Active",
                "observer_boot_time_delta_seconds_alarm_threshold": "0",
                "alarm_template_id": "0",
                "ob_cluster_id": "1731295860",
                "related_ob_cluster_id": "1731295860",
                "alarm_description_zh_cn": "集群：ob3245_ps，主机：xx.xx.xx.xx，告警：OBServer 进程停止。",
                "obzone": "zone1",
                "alarm_updated_at": "2025-06-06T13:36:51.231+08:00",
                "host_name": "fsx-deploy-host2-0",
                "alarm_group_zh_cn": "数据库内核"
            },
            "level": 2,
            "messagePush": {
                "configured": true,
                "noSuccessCount": 0,
                "successCount": 3
            },
            "name": "OBServer 进程停止",
            "resolvedAt": "2025-06-06T05:41:54Z",
            "scope": "Host",
            "status": "Inactive",
            "statusUpdatedAt": "2025-06-06T05:41:54Z",
            "summary": "alarm_template_id=0:ob_cluster=ob3245_ps-1731295860:host=xx.xx.xx.xx OBServer 进程停止",
            "target": "alarm_template_id=0:ob_cluster=ob3245_ps-1731295860:host=xx.xx.xx.xx",
            "updatedAt": "2025-06-06T05:36:51Z"
        },
        {
            "activeAt": "2025-06-06T02:57:52Z",
            "alarmGroups": ["数据库内核", "自愈"],
            "alarmId": 177,
            "alarmTarget": {
                "appType": "OceanBase",
                "excludeTargets": [],
                "includeTargets": [{
                    "cluster": {
                        "clusterId": 7,
                        "name": "ob4352_X",
                        "obClusterId": 1731295861
                    },
                    "tenants": [{
                        "name": "META$1004",
                        "obTenantId": 1004,
                        "tenantId": 19
                    }]
                }],
                "scope": "Tenant"
            },
            "alarmTemplateId": 0,
            "alarmType": "ob_tenant_request_queue_over_threshold",
            "appType": "OceanBase",
            "autoResolved": true,
            "containSelfcure": false,
            "description": "集群：ob4352_X，租户：META$1004，告警：OceanBase 租户请求队列超限。租户请求等待耗时：${request_queue_time_value_zh_cn}，请求队列长度 0 超过 -1。",
            "gmtCreate": "2025-06-06T02:57:52Z",
            "gmtModified": "2025-06-06T03:45:38.796021Z",
            "id": 177,
            "labels": {
                "ob_tenant_id": "1003",
                "ob_tenant_request_queue_size_value": "0",
                "__ob_tenant.id": "19",
                "app_type": "OceanBase",
                "alarm_threshold": "-1",
                "svr_ip": "xx.xx.xx.xx",
                "value_zh_tw": "0",
                "alarm_status_native": "Active",
                "ob_cluster_type_shown": "主",
                "alarm_level": "3",
                "obregion": "ob4352_X",
                "app_native": "OB",
                "alarm_summary_zh_tw": "alarm_template_id=0:ob_cluster=ob4352_X-1731295861:tenant_name=META$1004:host=xx.xx.xx.xx OceanBase 租戶請求隊列超限",
                "alarm_summary_en_us": "alarm_template_id=0:ob_cluster=ob4352_X-1731295861:tenant_name=META$1004:host=xx.xx.xx.xx OceanBase tenant request queue over threshold",
                "ob_tenant": "META$1004",
                "ob_tenant_request_queue_size_alarm_threshold": "-1",
                "alarm_type": "ob_tenant_request_queue_over_threshold",
                "alarm_status": "Active",
                "alarm_group_zh_tw": "數據庫內核,自愈",
                "host": "xx.xx.xx.xx",
                "alarm_scope": "Tenant",
                "ob_cluster": "ob4352_X",
                "alarm_description_zh_tw": "集群：ob4352_X，租戶：META$1004， 警示：OceanBase 租戶請求隊列超限。租戶請求等待耗時：${request_queue_time_value_zh_tw}，請求隊列長度 0 超過 -1。",
                "value_en_us": "0",
                "is_meta_tenant": "1",
                "app": "OB",
                "__ob_cluster.id": "7",
                "contain_selfcure": "0",
                "tenant_name": "META$1004",
                "alarm_duration": "2563",
                "level": "3",
                "related_svr_ips": "xx.xx.xx.xx",
                "alarm_name_en_us": "OceanBase tenant request queue over threshold",
                "message_type": "Alarm",
                "alarm_status_zh_cn": "告警中",
                "alarm_group_en_us": "dba,selfcure",
                "value_zh_cn": "0",
                "ob_tenant_request_queue_size_value_zh_cn": "0",
                "alarm_description_en_us": "OceanBase cluster: ob4352_X, tenant: META$1004, alert: OceanBase tenant request queue over threshold. The tenant request wait time is ${request_queue_time_value_en_us}, request queue size 0 is over -1.",
                "alarm_level_zh_cn": "警告",
                "tenant_role_en_us": "Primary",
                "ob_cluster_type": "PRIMARY",
                "alarm_summary_zh_cn": "alarm_template_id=0:ob_cluster=ob4352_X-1731295861:tenant_name=META$1004:host=xx.xx.xx.xx OceanBase 租户请求队列超限",
                "ob_cluster_type_zh_tw": "主",
                "alarm_description": "集群：ob4352_X，租户：META$1004，告警：OceanBase 租户请求队列超限。租户请求等待耗时：${request_queue_time_value_zh_cn}，请求队列长度 0 超过 -1。",
                "ob_cluster_type_native": "PRIMARY",
                "app_zh_tw": "OceanBase",
                "metrics": "request_queue_time,ob_tenant_request_queue_size",
                "ocp_ip": "xx.xx.xx.xx",
                "value_shown": "0",
                "tenant_id": "1003",
                "alarm_name": "OceanBase 租户请求队列超限",
                "alarm_status_zh_tw": "警示中",
                "vpc_name": "system-default",
                "related_tenant_names": "META$1004",
                "values": "0",
                "alarm_level_zh_tw": "警告",
                "tenant_role": "PRIMARY",
                "alarm_level_native": "3",
                "app_zh_cn": "OceanBase",
                "alarm_level_en_us": "Alert",
                "ob_cluster_type_en_us": "Primary",
                "auto_resolved": "1",
                "alarm_summary": "alarm_template_id=0:ob_cluster=ob4352_X-1731295861:tenant_name=META$1004:host=xx.xx.xx.xx OceanBase 租户请求队列超限",
                "ob_tenant_request_queue_size_value_zh_tw": "0",
                "alarm_active_at": "2025-06-06T10:57:51.799+08:00",
                "alarm_target": "alarm_template_id=0:ob_cluster=ob4352_X-1731295861:tenant_name=META$1004:host=xx.xx.xx.xx",
                "tenant_role_zh_tw": "主",
                "app_en_us": "OceanBase",
                "value": "0",
                "alarm_name_zh_tw": "OceanBase 租戶請求隊列超限",
                "ob_cluster_type_zh_cn": "主",
                "host_ip": "xx.xx.xx.xx",
                "related_ob_cluster_name": "ob4352_X",
                "ob_cluster_name": "ob4352_X",
                "alarm_name_zh_cn": "OceanBase 租户请求队列超限",
                "alarm_status_en_us": "Active",
                "tenant_role_shown": "主",
                "alarm_template_id": "0",
                "ob_cluster_id": "1731295861",
                "related_ob_cluster_id": "1731295861",
                "tenant_role_zh_cn": "主",
                "alarm_description_zh_cn": "集群：ob4352_X，租户：META$1004，告警：OceanBase 租户请求队列超限。租户请求等待耗时：${request_queue_time_value_zh_cn}，请求队列长度 0 超过 -1。",
                "tenant_role_native": "PRIMARY",
                "obzone": "zone1",
                "alarm_updated_at": "2025-06-06T10:57:51.799+08:00",
                "ob_tenant_request_queue_size_value_en_us": "0",
                "host_name": "obrd.8c.vd4-s4a7-n9",
                "alarm_group_zh_cn": "数据库内核,自愈"
            },
            "level": 3,
            "messagePush": {
                "configured": true,
                "noSuccessCount": 0,
                "successCount": 6
            },
            "name": "OceanBase 租户请求队列超限",
            "resolvedAt": "2025-06-06T03:45:38Z",
            "scope": "Tenant",
            "status": "Inactive",
            "statusUpdatedAt": "2025-06-06T03:45:38Z",
            "summary": "alarm_template_id=0:ob_cluster=ob4352_X-1731295861:tenant_name=META$1004:host=xx.xx.xx.xx OceanBase 租户请求队列超限",
            "target": "alarm_template_id=0:ob_cluster=ob4352_X-1731295861:tenant_name=META$1004:host=xx.xx.xx.xx",
            "updatedAt": "2025-06-06T03:40:34Z"
        }],
        "page": {
            "number": 1,
            "size": 10,
            "totalElements": 186,
            "totalPages": 19
        }
    },
    "duration": 317,
    "server": "21dc8a9b83",
    "status": 200,
    "successful": true,
    "timestamp": "2025-06-06T15:35:37.216+08:00",
    "traceId": "b61f0b63906e7e71"
}

```

 上一篇 下一篇 ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ)[AI](https://www.oceanbase.com/obi) 咨询热线
