首批通过分布式安全可靠测评,为关键业务系统打造
将 OCP 监控集成到 Prometheus
更新时间:2026-04-14 11:55:54
本节为您介绍如何使用 Prometheus 集成 OceanBase 业务监控。
应用场景
用户需要使用自有的 Prometheus 体系集成业务监控。
前提条件
- 已部署 V2.28 及以上版本的 prometheus 服务。
- 已部署 V4.2.2 及以上的 OCP 版本。
- 拥有主机读权限的账号。建议单独建一个相应用户,分配 HOST_VIEWER 角色(OCP 主机只读角色)。
操作步骤
登录 OCP 平台。
在左侧导航栏单击 系统管理 > 系统参数,确认以下三个系统参数的配置情况。
参数名称 描述 设置为 ocp.monitor.prometheus.service.discovery.enabled 是否开启 Prometheus http service discovery 服务 true ocp.monitor.server.exporter.auth.enabled 是否开启 OCP 自监控认证 false ocp.agent.auth.metric-auth-enabled 是否开启OCP Agent 的监控API鉴权 false 在 Prometheus 的配置文件中填写抓取配置。参考如下示例:
scrape_configs: - job_name: ocp_sd http_sd_configs: - url: 'http://xxx.xxx.xxx.xxx:port/api/v2/monitor/prometheus_sd' basic_auth: username: a**** password: '******'参数 描述 url OCP 服务的 IP 地址+端口+API 名称。 username 账号名称。建议单独建一个相应用户,分配 HOST_VIEWER 角色(OCP 主机只读角色)。 password 账号密码。 配置完成后,Prometheus 可通过接口获取 exporter 地址抓取数据,进行监控。
登录 Prometheus 服务地址,选择 Status > Targets。确认是否找到了所需要的 exporter 地址。
相关操作
OCP V4.3.0 已支持白屏监控对接 Prometheus 数据源,详情可参考 监控查询对接外部时序系统。
如果您正在使用 Grafana GUI 仪表盘进行数据可视化,可以在如下文档里下载 OCP 的 Grafana 模板 JSON 文件:Grafana 仪表板。