Skip to content

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 kafka_metrics receiver: instead of connecting to the Kafka protocol directly, the KloudMate Agent scrapes the JMX Prometheus Exporter endpoint that Strimzi already exposes on each broker and exporter pod.

  1. A Strimzi Kafka cluster.
  2. The JMX Prometheus Exporter enabled on the cluster.
  3. Metrics are exposed on port 9404.

Install and run the KloudMate Agent in your Kubernetes cluster. See Kubernetes for the Helm install steps.

  1. Go to Settings → Agents.
  2. Find the agent you want to configure and select the three dots.
  3. Choose Configure.
  4. Go to Collector config.

Add the following configuration. Replace the kafka-prod regex with your own Kafka namespace.

  • If the agent runs in managed mode, add it to the Custom config override section. See Custom config override.
  • If the agent runs in manual mode, add it directly to the collector configuration.
receivers:
  prometheus:
    config:
      global:
        scrape_interval: 30s
      scrape_configs:
        - job_name: kafka-resources
          kubernetes_sd_configs:
            - role: pod
          relabel_configs:
            - source_labels:
                - __meta_kubernetes_namespace
              action: keep
              regex: kafka-prod

            - source_labels:
                - __meta_kubernetes_pod_label_strimzi_io_component_type
              action: keep
              regex: kafka|kafka-exporter

            - source_labels:
                - __meta_kubernetes_pod_container_port_name
              action: keep
              regex: tcp-prometheus

service:
  pipelines:
    metrics/kafka-jmx:
      receivers:
        - prometheus
      processors:
        - batch
      exporters:
        - otlphttp

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.

Click Save. The Agent restarts and applies the new configuration.

After the Agent restarts:

  • Open Explore in KloudMate.
  • Query one of the scraped metrics, for example:
kafka_server_brokertopicmetrics_messagesin_total

kafka_server_replicamanager_leadercount

kafka_consumergroup_lag
  • Build dashboards or alerts once the data is visible.

Once the metrics are flowing, you can visualize broker availability, partition and replica health, message rates, and consumer group lag.

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
  • Kafka Integration — the kafka_metrics receiver 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.