# Confluent Cloud

> Send Kafka metrics from Confluent Cloud to Last9 using Prometheus Remote Write

Source: https://last9.io/docs/integrations/others/confluent-cloud/

This document will showcase how to send Kafka metrics from Confluent
Cloud to Last9 via the `vmagent` or Prometheus.

## Pre-requisites

1. You have created a Last9 cluster by following the [getting started guide](/docs/onboard/)
2. You have an active Confluent cloud account

## Setup

![Confluent Cloud Kafka Metrics to Last9](../../../../../assets/content/docs/integrations/others/confluent-cloud/9a35942-image.png)

The setup primarily has three components.

1. Confluent Cloud, which has the required metrics that you want to send to
   Last9. Confluent Cloud exposes metrics on `/export` GET endpoint.
2. `vmagent` or Prometheus will scrape the metrics from the `/export` endpoint
   and [remote write](https://last9.io/blog/what-is-prometheus-remote-write/) to
   Last9

The endpoint is as follows:

https://api.telemetry.confluent.cloud/v2/metrics/cloud/export

This endpoint requires
a Cloud API key for authentication.
The Cloud API key can be created using the
[Confluent Cloud CLI](https://docs.confluent.io/current/cloud/cli/).

:::caution

This API endpoint does not export the health metrics dataset.

:::

Once you have the key, use it in the `vmagent` configuration as follows:

```yaml
scrape_configs:
  - job_name: Confluent Cloud
    scrape_interval: 1m
    scrape_timeout: 1m
    honor_timestamps: true
    static_configs:
      - targets:
          - api.telemetry.confluent.cloud
    scheme: https
    basic_auth:
      username: <Cloud API Key>
      password: <Cloud API Secret>
    metrics_path: /v2/metrics/cloud/export
    params:
      "resource.kafka.id":
        - lkc-1
        - lkc-2
```

A sample docker-compose for`vmagent` can be as follows:

```yaml
version: "3.5"
services:
  vmagent:
    container_name: vmagent
    image: victoriametrics/vmagent
    ports:
      - 8429:8429
    volumes:
      - vmagentdata:/vmagentdata
      - /var/tmp:/var/tmp
      - ./vmagent.yaml:/etc/vmagent/vmagent.yaml
    command:
      - "--promscrape.config=/etc/vmagent/vmagent.yaml"
      - "--remoteWrite.tmpDataPath=/var/tmp/vmagent/"
      - "--remoteWrite.maxDiskUsagePerURL=10737418240"
      - "--remoteWrite.url=$levitate_remote_write_url"
      - "--remoteWrite.basicAuth.username=$levitate_remote_write_username"
      - "--remoteWrite.basicAuth.password=$levitate_remote_write_password"
    restart: always
    network_mode: "host"
volumes:
  vmagentdata: {}
```

This will start scraping metrics from Confluent Cloud and
[remote write](https://last9.io/blog/what-is-prometheus-remote-write/) to
Last9.

Find more details on the export metrics API specification and all metrics exposed by Confluent Cloud in the [Confluent Cloud Metrics API documentation](https://docs.confluent.io/cloud/current/monitoring/metrics-api.html).

## Next steps

Create a read token for your Last9 Cluster and follow our guide to
[Configure Grafana](/docs/grafana-config/) to visualize the time series
data getting sent to Last9.

---

## Troubleshooting

Please get in touch with us on [Discord](https://discord.com/invite/Q3p2EEucx9)
or [Email](mailto:support@last9.io) if you have any questions.
