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

# Connect to Grafana Cloud

> Use a Grafana Cloud Prometheus endpoint as the agent's metric source.

Grafana Cloud's hosted Prometheus is a valid source for Observer
agents. The connection uses basic auth with credentials issued by
Grafana for read access.

## Steps

1. In Grafana Cloud, open the stack details for the Prometheus
   instance you want the agent to read. Note:
   * **URL**: the Prometheus query endpoint (ending in `/api/prom`)
     (e.g. `https://prometheus-prod-01-eu-west-0.grafana.net/api/prom`).
   * **Username**: the numeric user id (e.g. `123456`).
   * **Password**: a Grafana Cloud access policy token with
     `metrics:read` scope.

2. Set the agent's environment:

   ```bash title=".env" theme={null}
   PROMETHEUS_SERVER_URL=https://prometheus-prod-01-eu-west-0.grafana.net/api/prom
   PROMETHEUS_BASIC_AUTH_ENABLED=true
   PROMETHEUS_USERNAME=123456
   PROMETHEUS_PASSWORD=glc_eyJ...   # access policy token
   ```

3. Restart the agent. Prometheus probe queries now go to Grafana
   Cloud.

## Verification

Define a Prometheus metric in the console (any working PromQL
query against the data Grafana Cloud holds). Within one push
interval the metric reports a value. Failures resolve to
`no_data` with a reason:

* `Unauthorized` when the access policy token is missing or
  lacking the required scope.
* `BadQuery` when the PromQL string is invalid against the data.
* `PromUpstream` for Grafana-side 5xx responses.

> [!NOTE]
>
> **Several Prometheus servers on one agent**
>
> When one agent reads from multiple Prometheus servers (Grafana
> Cloud + a local Prometheus, for example), the
> `PROMETHEUS_SERVER_URL` env var sets the default and individual
> metrics override it via the `prometheus_url` field on the metric
> definition.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.