prometheus/jmx_exporter

jmx exporter inside Confluent Kafka broker container

lijie123bes opened this issue · 2 comments

I'm using the following Kafka container (as a part of docker-compose.yml)

broker:
    image: confluentinc/cp-kafka:6.0.1
    hostname: broker
    container_name: broker
    depends_on:
      - zookeeper
    ports:
      - "29092:29092"
      - "9092:9092"
      - "9101:9101"
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
      KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
      KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
      KAFKA_JMX_PORT: 9101
      KAFKA_JMX_HOSTNAME: localhost
      EXTRA_ARGS: '-javaagent:/usr/share/jmx-exporter/jmx_prometheus_javaagent-0.15.0.jar=7101:/etc/jmx-exporter/config.yml'
    volumes:
      - ./kafka/data:/var/lib/kafka/data
      - ./jmx-exporter/kafka-2_0_0.yml:/etc/jmx_exporter/config.yml
      - ./jmx-exporter/jar:/usr/share/jmx_exporter/

Jmx exporter causes container to crash, here are the logs:

===> Launching ... 
===> Launching kafka ... 
Error occurred during initialization of VM
Error opening zip file or JAR manifest missing : /usr/share/jmx-exporter/jmx_prometheus_javaagent-0.15.0.jar
agent library failed to init: instrument

I verified jmx exporter jar and it's config to be available inside container.

jmx_prometheus_javaagent-0.15.0.jar has been downloaded from here: github.com/prometheus/jmx_exporter

Any ideas?

I encountered the same issue

This is a configuration issue. You will need to look at your ultimate command line to launch the Confluent Platform server (Kafka.)

Also, 0.15.0 is old (released on 2021-01-25.) I suggest you upgrade to the latest version.