> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokenfactory.nebius.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Observability API integrations

## How to connect Prometheus

<Note>
  Prometheus can only show a limited amount of monitoring data. If you have a large infrastructure, consider connecting a data source in Grafana® instead
</Note>

1. Issue a [static API key in Nebius Token Factory UI](https://tokenfactory.nebius.com/project/api-keys).
2. [Download the latest release](https://prometheus.io/download) 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:

<CodeGroup>
  ```yaml Prometheus 3 theme={null}
  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'
  ```

  ```yaml Prometheus 2 theme={null}
  scrape_configs:
    - job_name: 'Export time series from Nebius Monitoring'
      honor_labels: true
      scrape_interval: 15s
      scheme: https
      metric_name_validation_scheme: legacy
      scrape_protocols:
        - OpenMetricsText0.0.1
      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'
  ```
</CodeGroup>

In this file, change the following parameters:

* `bearer_token`: enter the static key that you [got earlier.](https://tokenfactory.nebius.com/project/api-keys)
* `metrics_path`: specify your project ID in the URL.

  To get the project ID, go to the [Nebius Token Factory UI →  Project settings](https://tokenfactory.nebius.com/project/). 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:

  ```yaml theme={null}
  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](https://prometheus.io/docs/prometheus/latest/querying/basics/).

1. Make sure that you have Grafana available, in any of these ways:
   * [Install Grafana on your local machine](https://grafana.com/docs/grafana/latest/setup-grafana/installation/).
   * [Create an account in Grafana Cloud](https://grafana.com/auth/sign-up/create-user).
2. Open Grafana in your browser.
3. In the side menu, select **Connections** → **Data sources**.
4. In the top right corner, click **Add new data source**.
5. Select **Prometheus**.
6. In the Prometheus configuration, enter the following settings:
   * **Connection** → **Prometheus 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](https://console.nebius.com/settings) page of the web console.
   * **Authentication** → **HTTP headers**: click **Add header** and enter `Authorization` and the value of the static key that you [got earlier](https://docs.nebius.com/observability/metrics/grafana#prerequisites).
7. Click **Save and test**. If Prometheus is connected successfully, you should see the "Successfully queried the Prometheus API" message.
