# Grafana (/docs/integrations/grafana)



Connect Grafana to Tinybird RawTree [#connect-grafana-to-tinybird-rawtree]

Grafana can query your RawTree tables through the deployment’s direct HTTPS endpoint.
Tinybird RawTree is protocol-compatible with ClickHouse® and you can take advantage of [ClickHouse's data source from Grafana Labs](https://grafana.com/grafana/plugins/grafana-clickhouse-datasource/).

Get the deployment hostname and API key [#get-the-deployment-hostname-and-api-key]

This setup requires your deployment-specific hostname and a direct HTTPS endpoint for SQL on port `8443`.

For a cloud deployment, use the Database SQL interface that matches your cluster’s deployment ID.

| Cloud region              | Database SQL interface                                 |
| ------------------------- | ------------------------------------------------------ |
| N. Virginia (`us-east-1`) | `https://api.765eb5f5.us-east-1.aws.rawtree.com:8443/` |
| Ireland (`eu-west-1`)     | `https://api.78d4d9f2.eu-west-1.aws.rawtree.com:8443/` |

1. Open your cluster in the Tinybird RawTree dashboard.
2. Open &#x2A;*Connect → App (API/SDK)**.
3. Copy the **Regional API** hostname that matches `api.<deployment_id>.<cloud_region>.aws.rawtree.com`.
4. Create a key for Grafana with **Read only** access under **API keys**.

You can also obtain the regional ID using the CLI or API.
Set `RAWTREE_API_KEY` to the read-only key you created for Grafana.
Both examples use `jq` to show the deployment ID and cloud region for your cluster.

<SnippetTabs label="Find your cluster’s deployment ID and cloud region" surfaces="[&#x22;API&#x22;, &#x22;CLI&#x22;]">
  <SnippetTab value="API">
    ```bash test
    curl -fsS "https://api.rawtree.com/v1/clusters" \
      -H "Authorization: Bearer $RAWTREE_API_KEY" |
      jq '.clusters[] | {deployment_id, cloud_region}'
    ```
  </SnippetTab>

  <SnippetTab value="CLI">
    ```bash test
    rtree cluster list --api-url https://api.rawtree.com --json |
      jq '.clusters[] | {deployment_id, cloud_region}'
    ```
  </SnippetTab>
</SnippetTabs>

Configure the Grafana data source [#configure-the-grafana-data-source]

1. Open **Connections → Add new connection** in Grafana.
2. Select **ClickHouse** by Grafana Labs.
3. Install the plugin if Grafana prompts you.
4. Select **Add new data source**.
5. Enter the connection settings below.

| Grafana setting           | Value                                                                  |
| ------------------------- | ---------------------------------------------------------------------- |
| `Server address`          | The deployment hostname only. Omit `https://`, the port, and the path. |
| `Protocol`                | `HTTP`                                                                 |
| `Secure Connection`       | On                                                                     |
| `Server port`             | `8443`                                                                 |
| `Skip TLS Verify`         | Off                                                                    |
| `HTTP URL Path`           | Leave empty to use `/`.                                                |
| `Username` and `Password` | Leave both empty.                                                      |

Set the bearer token under `Custom HTTP Headers`.

1. Select **Add Header**.
2. Enter `Authorization` in `Header Name`.
3. Enable `Secure`.
4. Enter `Bearer <API_KEY>` in `Secure Header Value`, substituting your read-only key for `<API_KEY>`.
5. Select **Save & test**.

Grafana reports **Data source is working**.

Run a query [#run-a-query]

1. Open **Explore** in Grafana.
2. Select the data source you just configured.
3. Select **SQL Editor**.
4. Run this query in **Table** format.

```sql test
SELECT 1 AS connected
```

The result contains one row with `1` in the `connected` column.

If Grafana reports `401 Unauthorized`, check the bearer header and the key’s expiration.
If the connection times out, check that the Grafana server can reach the deployment hostname on TCP port `8443`.
