Using external Prometheus for monitoring
You can use Prometheus federation to collect metrics from the built-in Prometheus server and store them on an external server. To configure federation, install an external Prometheus server, as described in the official documentation, and then connect it to your cluster via the open Prometheus API port.
To open a port for the Prometheus API
- On the Infrastructure > Networks screen, click Edit and then Create traffic type.
-
In the Create traffic type window, specify a custom name in the Name field and 9090 in the Port field. Then, click Create.
- Click Assign to networks next to the Custom traffic types section, and then add the created traffic type to your public network by selecting the corresponding check box.
- Click Save to apply the changes.
You can now connect to the built-in Prometheus server at http://<admin_panel_IP_address>:9090.
To connect your cluster to the external Prometheus
On the external Prometheus server, create the federation configuration file. For example:
scrape_configs: - job_name: 'federate' scrape_interval: 15s honor_labels: true metrics_path: '/federate' params: 'match[]': - '{job="ostor"}' - '{__name__=~"job:.*"}' static_configs: - targets: - '<admin_panel_IP_address>:9090'
where:
metrics_path
is the endpoint of the source Prometheus server to collect metrics from./federate
is the default endpoint for retrieving current values for selected time series.honor_labels
is the scape option that allows (false
) or prohibits (true
) overwriting any labels exposed by the source Prometheus server.-
match[]
defines time series to be scraped. You need to specify at least onematch[]
URL parameter and an instant vector selector likeup
or{job="ostor"}
for eachmatch[]
argument.In the given example, the external Prometheus server will collect any series with the label
job="ostor"
or a metric name starting withjob:
. targets
points to the source Prometheus server.