# Monitor Connectors in Kubernetes

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [streaming-full.txt](https://docs.redpanda.com/streaming-full.txt)

---
title: Monitor Connectors in Kubernetes
latest-operator-version: v26.1.4
# EOL = End-of-Life (support lifecycle status)
page-is-nearing-eol: "false"
page-is-past-eol: "true"
page-eol-date: December 22, 2024
latest-console-tag: v3.7.3
latest-connect-version: 4.93.0
docname: kubernetes/monitoring/k-monitor-connectors
page-component-name: streaming
page-version: "23.3"
page-component-version: "23.3"
page-component-title: Streaming
page-relative-src-path: kubernetes/monitoring/k-monitor-connectors.adoc
page-edit-url: https://github.com/redpanda-data/docs/edit/v/23.3/modules/manage/pages/kubernetes/monitoring/k-monitor-connectors.adoc
description: Monitor the health of your Redpanda Connectors using managed connector metrics.
page-git-created-date: "2024-01-04"
page-git-modified-date: "2024-02-26"
support-status: past end-of-life
---

<!-- Source: https://docs.redpanda.com/streaming/23.3/manage/kubernetes/monitoring/k-monitor-connectors.md -->

You can monitor the health of your Redpanda Connectors with metrics that are exported through a Prometheus endpoint at the default port 9404. You can use Grafana to visualize the metrics and set up alerts.

## [](#prerequisites)Prerequisites

-   A Kubernetes cluster. You must have `kubectl` with at least version 1.21.

    To check if you have `kubectl` installed:

    ```bash
    kubectl version --short --client
    ```

-   [Helm](https://helm.sh/docs/intro/install/) installed with at least version 3.10.0.

    To check if you have Helm installed:

    ```bash
    helm version
    ```


## [](#limitations)Limitations

The connectors dashboard renders metrics that are exported by managed connectors. However, when a connector does not create a task (for example, an empty topic list), the dashboard will not show metrics for that connector.

## [](#configure-prometheus)Configure Prometheus

[Prometheus](https://prometheus.io/) is a system monitoring and alerting tool. It collects and stores metrics as time-series data identified by a metric name and key/value pairs.

To configure Prometheus to monitor Redpanda metrics in Kubernetes, you can use the [Prometheus Operator](https://prometheus-operator.dev/):

1.  Follow the steps to [deploy the Prometheus Operator](https://prometheus-operator.dev/docs/user-guides/getting-started/).

    Make sure to configure the Prometheus resource to target your Pods that are running Kafka Connect:

    `prometheus.yaml`

    ```yaml
    apiVersion: monitoring.coreos.com/v1
    kind: Prometheus
    metadata:
      name: prometheus
    spec:
      serviceAccountName: prometheus
      podMonitorNamespaceSelector:
        matchLabels:
          name: <namespace>
      podMonitorSelector:
        matchLabels:
          app.kubernetes.io/name: connectors
      resources:
        requests:
          memory: 400Mi
      enableAdminAPI: false
    ```

    -   `podMonitorNamespaceSelector.matchLabels.name`: The namespace in which Redpanda is deployed. The Prometheus Operator looks for PodMonitor resources in this namespace.

    -   `podMonitorSelector.matchLabels.app.kubernetes.io/name`: The value of `fullnameOverride` in your Redpanda Helm chart. The default is `connectors`. The Redpanda Helm chart creates the PodMonitor resource with this label.


2.  Deploy the Redpanda Connectors subchart with monitoring enabled to deploy the PodMonitor resource:

    ### Helm + Operator

    `redpanda-cluster.yaml`

    ```yaml
    apiVersion: cluster.redpanda.com/v1alpha1
    kind: Redpanda
    metadata:
      name: redpanda
    spec:
      chartRef: {}
      clusterSpec:
        connectors:
          enabled: true
          monitoring:
            enabled: true
            scrapeInterval: 30s
    ```

    ```bash
    kubectl apply -f redpanda-cluster.yaml --namespace <namespace>
    ```


    ### Helm


    #### --values

    `prometheus-monitoring.yaml`

    ```yaml
    connectors:
      enabled: true
      monitoring:
        enabled: true
        scrapeInterval: 30s
    ```

    ```bash
    helm upgrade --install redpanda redpanda/redpanda --namespace <namespace> --create-namespace \
    --values prometheus-monitoring.yaml --reuse-values
    ```


    #### --set

    ```bash
    helm upgrade --install redpanda redpanda/redpanda \
      --namespace <namespace> \
      --create-namespace \
      --set connectors.enabled=true \
      --set connectors.monitoring.enabled=true \
      --set connectors.monitoring.scrapeInterval="30s"
    ```

3.  Wait until all Pods are running:

    ```bash
    kubectl -n <namespace> rollout status statefulset redpanda --watch
    ```

4.  Ensure that the PodMonitor was deployed:

    ```bash
    kubectl get podmonitor --namespace <namespace>
    ```

5.  Ensure that you’ve [exposed the Prometheus Service](https://prometheus-operator.dev/docs/user-guides/getting-started/#exposing-the-prometheus-service).

6.  Expose the Prometheus server to your localhost:

    ```bash
    kubectl port-forward svc/prometheus 9090
    ```

7.  [Open Prometheus](http://localhost:9090/graph), and verify that Prometheus is scraping metrics from your endpoints.


## [](#import-the-grafana-dashboard)Import the Grafana dashboard

You can use [Grafana](https://grafana.com/oss/grafana/) to query, visualize, and generate alerts for metrics. Redpanda provides a [Grafana dashboard for connectors](https://github.com/redpanda-data/observability/blob/main/grafana-dashboards/Connectors.json).

To create and use the Grafana dashboard to gather telemetry for your managed connectors, import the connectors dashboard JSON file (`Connectors.json`).

## [](#managed-connector-metrics)Managed connector metrics

You can monitor the following metrics for your Redpanda managed connectors.

### [](#connector-tasks)Connector tasks

Number of tasks for a specific connector, grouped by status:

-   `running` - Tasks that are healthy and running.

-   `paused` - Tasks that were paused by a user request.

-   `failed` - Tasks that failed during execution.


Expect only `running` and `paused` tasks. Create an alert for failed tasks.

* * *

### [](#sink-connector-lag)Sink connector lag

The number of records still to be processed by a connector. This metric is emitted for sink connectors only (`last_offset` - `current_offset`).

For newly-created connectors, the metric is high until the connector sinks all historical data.

Expect the lag not to increase over time.

* * *

### [](#mm2-replication-latency)MM2 replication latency

Age of the last record written to the target cluster by the MirrorMaker 2 connector. This metric is emitted for each partition.

For newly-created connectors, the metric is high until the connector processes all historical data.

Expect the latency to not increase over time.

* * *

### [](#count-of-the-records-sent-to-target-by-topic)Count of the records sent to target (by topic)

Count of records sent to the cluster by source connectors for each topic.

* * *

### [](#redpanda-consumer-latency)Redpanda consumer latency

The Redpanda consumer fetch latency for sink connectors.

* * *

### [](#redpanda-producer-latency)Redpanda producer latency

The Redpanda producer request latency for source connectors.

* * *

### [](#bytes-in)Bytes in

Bytes per second (throughput) of data from Redpanda to managed connectors.

* * *

### [](#bytes-out)Bytes out

Bytes per second (throughput) of data from managed connectors to Redpanda.

* * *

### [](#record-error-rate)Record error rate

-   `record errors` - Total number of record errors seen in connector tasks.

-   `record failures` - Total number of record failures seen in connector tasks.

-   `record skipped` - Total number of records skipped by connector tasks.


* * *

### [](#producer-record-rate)Producer record rate

-   `record sent` - Total number of records sent by connector producers.

-   `record retry` - Total number of records sent retries by connector producers.


* * *

### [](#producer-record-error-rate)Producer record error rate

Rate of producer errors when producing records to Redpanda.

## [](#next-steps)Next steps

[Create and Manage Connectors in Kubernetes](https://docs.redpanda.com/streaming/23.3/manage/kubernetes/k-manage-connectors/).

## Suggested labs

-   [Owl Shop Example Application in Docker](https://docs.redpanda.com/labs/docker-compose/owl-shop/)
-   [Start a Single Redpanda Broker with Redpanda Console in Docker](https://docs.redpanda.com/labs/docker-compose/single-broker/)
-   [Start a Cluster of Redpanda Brokers with Redpanda Console in Docker](https://docs.redpanda.com/labs/docker-compose/three-brokers/)

[Search all labs](https://docs.redpanda.com/labs)