Skip to main content

How to connect Prometheus

Prometheus can only show a limited amount of monitoring data. If you have a large infrastructure, consider connecting a data source in Grafana® instead
  1. Issue a static API key in Nebius Token Factory UI.
  2. Download the latest release of Prometheus for your platform.
  3. Extract the contents and switch to the folder with Prometheus:
    tar xvfz prometheus-***.tar.gz
    cd prometheus-***
    
  4. Create the prometheus.yml configuration file that configures Prometheus to retrieve Monitoring metrics. Use one of the following configurations depending on your Prometheus version:
scrape_configs:
  - job_name: 'Export time series from Nebius Monitoring'
    honor_labels: true
    scrape_interval: 15s
    scheme: https
    metrics_path: '/projects/<project_ID>/service-provider/prometheus/federate'
    params:
      match[]:
        - '{__name__=~".+"}'
    bearer_token: '<static_API_key>'
    static_configs:
      - targets:
        - 'read.monitoring.api.nebius.cloud'
In this file, change the following parameters:
  • bearer_token: enter the static key that you got earlier.
  • metrics_path: specify your project ID in the URL. To get the project ID, go to the Nebius Token Factory UI →  Project settings. Under the project’s name, click  → Copy project ID.
  • match[]: optionally specify which data Prometheus collects by filtering for labels or metric names. For example, to collect only metrics with the disk prefix, set the following value:
    match[]:
      - '{__name__=~"^disk.*"}'
    
  • scrape_interval: you can change the interval, but the recommended interval is no less than 15 seconds.
Start Prometheus:
./prometheus --config.file=prometheus.yml

How to connect Grafana data source

To view visualized metrics in Grafana dashboards, connect Grafana to Monitoring and query the data by using PromQL.
  1. Make sure that you have Grafana available, in any of these ways:
  2. Open Grafana in your browser.
  3. In the side menu, select ConnectionsData sources.
  4. In the top right corner, click Add new data source.
  5. Select Prometheus.
  6. In the Prometheus configuration, enter the following settings:
    • ConnectionPrometheus server URL: https://read.monitoring.api.nebius.cloud/projects/<project_ID>/service-provider/prometheus. Specify your project ID in the URL. You can get it on the Project settings page of the web console.
    • AuthenticationHTTP headers: click Add header and enter Authorization and the value of the static key that you got earlier.
  7. Click Save and test. If Prometheus is connected successfully, you should see the “Successfully queried the Prometheus API” message.