> For the complete documentation index, see [llms.txt](https://docs.groundcover.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.groundcover.com/investigate/querying-your-groundcover-data/using-groundcover-as-a-database.md).

# Using groundcover as Prometheus/Clickhouse database in a Self-hosted Grafana

Exposing Data Sources for BYOC installations

groundcover [BYOC](/collect-data/byoc.md) exposes [Prometheus](https://grafana.com/grafana/plugins/prometheus/) data sources for programmatic access via API, and integration with customer owned Grafana instances.

{% hint style="warning" %}
Different steps are required for [On-Prem](/collect-data/customize-deployment/on-premise-deployment.md) deployments, contact us for additional info.
{% endhint %}

## Requirements

#### API Key

The groundcover tenant API KEY is required for configuring the data source connection.

You can obtain your API key from the [API Keys page](/administer/api-keys.md) in the groundcover console.

> For this example we will use the key `API-KEY-VALUE`

## Setup

### Prometheus

#### Grafana Data Source Configuration

Configure Grafana prometheus Data Source by following these steps logged in as Grafana Admin.

1. Connections > Data Sources > + Add new data source
2. Pick **Prometheus**
   1. Name: `groundcover-prometheus`
   2. Prometheus server URL: `https://app.groundcover.com/api/prometheus`
   3. Customer HTTP Headers > Add Header
      1. Header: `authorization`
      2. Value: `Bearer API-KEY-VALUE`
   4. Performance
      1. Prometheus type: `Prometheus`
      2. Prometheus version: `> 2.50.x`
3. Click "Save & test"

{% hint style="info" %}
"Successfully queried the Prometheus API" means the integration was configured correctly.
{% endhint %}

## Legacy Configuration

The following configurations are deprecated but may still be in use in older setups.

### Datasources API Key

{% hint style="warning" %}
The legacy datasources API key can be obtained by running: `groundcover auth get-datasources-api-key`
{% endhint %}

### ClickHouse

{% hint style="warning" %}
ClickHouse datasource integration is deprecated and no longer supported for new installations.
{% endhint %}

Configure Grafana ClickHouse Data Source by following these steps logged in as Grafana Admin.

1. Connections > Data Sources > + Add new data source
2. Pick **ClickHouse**
   1. Name: `groundcover-clickhouse`
   2. **Server**
      1. Server address: `ds.groundcover.com`
      2. Server port: `443`
      3. Protocol: `HTTP`
      4. Secure Connection: `ON`
   3. HTTP Headers
      1. Forward Grafana HTTP Headers: `ON`
   4. **Credentials**
      1. Username: **Leave empty**
      2. Password: `API-KEY-VALUE`
   5. Additional Properties
      1. Default database: `groundcover`
3. Click "Save & test"

{% hint style="info" %}
"Data source is working" means the integration was configured correctly.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.groundcover.com/investigate/querying-your-groundcover-data/using-groundcover-as-a-database.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
