Integrate OCP monitoring into Prometheus

2025-03-28 08:05:55  Updated

This section describes how to integrate the monitoring feature of OceanBase Database into Prometheus.

Scenarios

You need to use your Prometheus system for integrated business monitoring.

Prerequisites

  • Make sure that you have the following permissions:
    • Resource Permissions : Cluster Read-only, Tenant Read-only, OBProxy Read-only, Arbitration Service Read-only, Binlog Service Read-only, or Host Read-only permission
    • Menu Permissions : Permission on the System Parameters menu of System Management
  • You have deployed Prometheus V2.28 or later.
  • You have deployed OceanBase Cloud Platform (OCP) V4.2.2 or later.
  • You have the read permission on the host. We recommend that you create a dedicated user for Prometheus integration and grant the HOST_VIEWER role to the user. The HOST_VIEWER role has read-only permission on the OCP host .

Procedure

  1. Log on to the OCP console.

  2. In the left-side navigation pane, choose System Management > System Parameters . Check the values of the following system parameters.

    Parameter Description Expected value
    ocp.monitor.prometheus.service.discovery.enabled Specifies whether to enable Prometheus HTTP service discovery. true
    ocp.monitor.server.exporter.auth.enabled Specifies whether to enable authentication for OCP self-monitoring. false
    ocp.agent.auth.metric-auth-enabled Specifies whether to enable authentication for the monitoring API of OCP-Agent. false
  3. Configure the data collection parameters in the Prometheus configuration file. Here is an example:

    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: '******'
    
    Parameter Description
    url The IP address, port, and API of the OCP service.
    username The name of the account. We recommend that you create a dedicated user for Prometheus integration and grant the HOST_VIEWER role to the user. The HOST_VIEWER role has read-only permission on the OCP host .
    password The password for the account.

    After you specify the parameters, Prometheus can call APIs to obtain the exporter addresses and collect monitoring data.

  4. Log on to the service address of Prometheus and choose Status > Targets. Then, verify that the exporter address is correct.

Contact Us