Kafka JMX Exporter Integration
Use this integration when your Kafka cluster runs on Kubernetes through Strimzi and already exposes JMX metrics in Prometheus format. It’s a Kubernetes-native alternative to Kafka Integration’s kafkametrics receiver: instead of connecting to the Kafka protocol directly, the OpenTelemetry Collector scrapes the JMX Prometheus Exporter endpoint that Strimzi already exposes on each broker and exporter pod.
Prerequisites
Section titled “Prerequisites”- A Strimzi Kafka cluster.
- The JMX Prometheus Exporter enabled on the cluster.
- Metrics exposed on port
9404.
Step 1: Install the Agent
Section titled “Step 1: Install the Agent”Install and run the KloudMate Agent in your Kubernetes cluster. See Kubernetes for the Helm install steps.
Step 2: Define the Prometheus Receiver for Kafka JMX Metrics
Section titled “Step 2: Define the Prometheus Receiver for Kafka JMX Metrics”Add the following configuration to the Agent’s collector configuration.
This uses Kubernetes service discovery to find every pod in the cluster, then narrows the scrape targets down through three relabel_configs stages: the first keeps only pods in the kafka-prod namespace, the second keeps only pods whose Strimzi component-type label is kafka or kafka-exporter, and the third keeps only the tcp-prometheus container port those pods expose. Replace the kafka-prod regex with your own Kafka namespace before applying the configuration.
Step 3: Add to Pipeline
Section titled “Step 3: Add to Pipeline”Add the prometheus receiver to the metrics pipeline in your Agent configuration.
Step 4: Apply the Configuration
Section titled “Step 4: Apply the Configuration”If you run the OpenTelemetry Collector through the KloudMate Agent in managed mode, add this configuration through Custom config override instead of editing the deployment’s YAML directly — the override merges it into the running configuration without switching the agent to manual mode. If you operate your own OpenTelemetry Collector, merge this block into its existing configuration instead.
Step 5: Restart the Collector
Section titled “Step 5: Restart the Collector”If the Agent runs as a Kubernetes workload, restart whichever one runs your Collector:
or
Step 6: Validate in KloudMate
Section titled “Step 6: Validate in KloudMate”After the Agent restarts:
- Open Explore in KloudMate.
- Query one of the scraped metrics, for example:
- Build dashboards or alerts once the data is visible.
Metrics Collected
Section titled “Metrics Collected”This integration collects:
- Kafka broker metrics
- Kafka topic metrics
- Kafka consumer group metrics
- Kafka Exporter metrics
- JVM metrics
- Broker health metrics
- Replication metrics
- Network metrics
- Request metrics
- Controller metrics
Related
Section titled “Related”- Kafka Integration — the
kafkametricsreceiver alternative, for brokers reachable directly over the Kafka protocol instead of through JMX. - Prometheus Integration — the general-purpose pattern this integration builds on.
- Custom config override — how to add this receiver to a managed KloudMate Agent.
- Explore — where to query the collected metrics.