Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Trouble exporting kafka metrics via JMX #871

Open
saadgit opened this issue Aug 20, 2020 · 0 comments
Open

Trouble exporting kafka metrics via JMX #871

saadgit opened this issue Aug 20, 2020 · 0 comments

Comments

@saadgit
Copy link

saadgit commented Aug 20, 2020

Similar to #739

I am not able to get kafka.server metrics over JMX. jConsole doesnt show kafka.server running but in broker logs, kafka.server is started. On curl localhost:9999/metrics inside broker gives empty reply.
Below is the docker-compose from cp-all-in-one (5.2.1) with some additional properties for KAFKA_JMX_HOST, KAFKA_JMX_PORT, and KAFKA_JMX_OPTS


version: '2'
services:
  zookeeper:
    image: confluentinc/cp-zookeeper:5.2.1
    hostname: zookeeper
    container_name: zookeeper
    ports:
      - "2181:2181"
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000
      
  broker:
    image: confluentinc/cp-enterprise-kafka:5.2.1
    hostname: broker
    container_name: broker
    depends_on:
      - zookeeper
    ports:
      - "29092:29092"
      - "9092:9092"
    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_METRIC_REPORTERS: io.confluent.metrics.reporter.ConfluentMetricsReporter
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
      KAFKA_JMX_HOSTNAME: localhost 
      KAFKA_JMX_PORT: 9999
      KAFKA_JMX_OPTS: "-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.rmi.port=9999 -Dcom.sun.management.jmxremote.port=9999 -Djava.net.preferIPv4Stack=true"
      CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: broker:29092
      CONFLUENT_METRICS_REPORTER_ZOOKEEPER_CONNECT: zookeeper:2181
      CONFLUENT_METRICS_REPORTER_TOPIC_REPLICAS: 1
      CONFLUENT_METRICS_ENABLE: 'true'
      CONFLUENT_SUPPORT_CUSTOMER_ID: 'anonymous'

I am reading metrics through MBeanServerConnection. The metrics I am interested in are kafka.server:type=BrokerTopicMetrics,name=BytesInPerSec. I can see the metrics exposed in Confluent Control Center (localhost:9021) but it seems like metrics are not available as MBean as jconsole only showing Kafka, kafka.producer, kafka.consumer, but no kafka.server

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant