> 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/integrations/data-sources/prometheus/push-metrics-to-groundcover.md).

# Pushing Metrics using Remote Write

Send Prometheus metrics to groundcover using the [Remote Write](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write) protocol for direct ingestion from external sources or non-Kubernetes environments.

## Sending from Kubernetes

The recommended way to ship data via remote write in Kubernetes it by writing directly to the sensors deployed by groundcover.

{% hint style="success" %}
No ingestion key is needed when sending data inside Kubernetes clusters.
{% endhint %}

### Setting up remote write

**Prometheus (`prometheus.yml`):**

```yaml
remote_write:
  - url: "http://groundcover-sensor.groundcover.svc.cluster.local:8428/api/v1/write"
```

**vmagent (flags):**

```bash
-remoteWrite.url=http://groundcover-sensor.groundcover.svc.cluster.local:8428/api/v1/write
```

## Sending from Non-Kubernetes

The recommended way to ship data from Non-Kubernetes hosts is to the BYOC ingestion endpoint.

### Get your BYOC endpoint

Find your BYOC endpoint in the [ingestion keys tab](https://app.groundcover.com/settings?selectedTab=ingestion-keys).

### Create an ingestion key

See how in the [ingestion key docs](/use-groundcover/remote-access-and-apis/ingestion-keys.md).

### Set up Remote Write

{% hint style="info" %}
You can enrich your metrics with additional context using special headers. For detailed information, see our [Enriching Data with Headers](https://github.com/groundcover-com/docs/blob/main/integrations/data-sources/enriching-data-with-headers.md) guide.
{% endhint %}

#### Examples

**Prometheus (`prometheus.yml`):**

```yaml
remote_write:
  - url: "https://{BYOC_ENDPOINT}/api/v1/write"
    headers:
      apikey: "{ingestion-key}"
      x-groundcover-service-name: "my-service-name"
      x-groundcover-env-name: "my-env"
```

**vmagent (flags):**

```bash
-remoteWrite.url=https://{BYOC_ENDPOINT}/api/v1/write
-remoteWrite.headers=apikey:{ingestion-key}^^x-groundcover-service-name:my-service-name^^x-groundover-env-name:my-env
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.groundcover.com/integrations/data-sources/prometheus/push-metrics-to-groundcover.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
