Note
This parameter is available starting with V4.4.2 BP3.
Overview
prometheus_metrics_port specifies the port number for the embedded Prometheus /metrics HTTP exposer of the observer or arbserver process. Setting it to 0 disables the exposer and prevents metrics from being exposed externally.
After the process starts, the Prometheus server can periodically pull basic metrics such as CPU, memory, and disk through the GET /metrics interface, as well as business metrics like log stream leader/follower, election test, config_version, and mode_version.
Privilege requirements
Query parameters
Both the
systenant and all user tenants can query this parameter using theSHOW PARAMETERSstatement or theGV$OB_PARAMETERSview.Modify parameters
Only the
systenant can modify this parameter. User tenants cannot modify it.
Attributes
Attribute |
Description |
|---|---|
| Parameter type | Int |
| Default value | 2886 |
| Value range | [0, 65535], where 0 indicates that the exposer is disabled. |
| Modifiable | Yes. You can modify it by using the ALTER SYSTEM SET statement. |
| Whether to restart the OBServer node for the change to take effect | Yes, the modification takes effect only after you restart the OBServer node. |
Usage instructions
This parameter is read only once during process startup and the port is bound accordingly: if the port value is greater than
0, the process starts the exposer on0.0.0.0:<port>. If the port value is0, the process internally maintains metric counts but does not expose them externally.Modifying this parameter at runtime using the
ALTER SYSTEM SETstatement does not rebind ports. The change takes effect only after restarting the observer or arbserver process.When deploying arbserver or observer, you can specify the listening port of the exposer via startup parameters or configuration files. The deployment environment must allow inbound access to this port, so that the Prometheus server can periodically pull metrics from
http://<host>:<prometheus_metrics_port>/metrics.If you do not need to expose metrics externally (for example, in a test environment, when data is collected over an intranet channel, or if the port is occupied), you can set this parameter to
0to disable the exposer.If the port is occupied or listening fails during startup, the exposer initialization will fail and it will automatically close. All metrics will stop updating, but this does not affect the normal startup of the observer/arbserver processes. The system will log a WARN-level error message for the listening failure (
disable Prometheus monitoring). After resolving the port conflict, you need to restart the observer/arbserver processes to resume metric collection.For detailed operations and metric descriptions on collecting arbitration service monitoring metrics using Prometheus, see Arbitration service monitoring.
Configuration example
There are two ways to configure this parameter:
Method 1: Set via startup parameters during deployment
You can enable the metric collection interface by appending a port parameter to the process startup configuration. Example:
observer ... -o prometheus_metrics_port=2886
When using the default configuration, you do not need to explicitly specify a port, as the process will attempt to listen on 2886. To disable the metric collection interface, set this parameter to 0. Example:
observer ... -o prometheus_metrics_port=0
Method 2: Modify the parameter during cluster runtime using the ALTER SYSTEM SET statement
You can modify the port during cluster runtime by using the ALTER SYSTEM SET statement. The change takes effect after you restart the observer or arbserver process.
Use the
ALTER SYSTEM SETstatement to modify the port.obclient> ALTER SYSTEM SET prometheus_metrics_port = 2887;The change takes effect after you restart the observer or arbserver process.
In this case, if you want to disable the metric collection interface, change the port number of prometheus_metrics_port to 0, and the change will only take effect after restarting the process.
After the process is started, you can collect metrics using the following command.
curl http://<host>:2886/metrics
