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

  1. On the Infrastructure > Networks screen, click Edit and then Create traffic type.
  2. In the Create traffic type window, specify a custom name in the Name field and 9090 in the Port field. Then, click Create.

  3. 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.
  4. 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 one match[] URL parameter and an instant vector selector like up or {job="ostor"} for each match[] argument.

    In the given example, the external Prometheus server will collect any series with the label job="ostor" or a metric name starting with job:.

  • targets points to the source Prometheus server.