I will also +1 the JMX Prometheus exporter. It's capable of running as a -javaagent so it's really easy to get up and running. And we happen to use Prometheus anyways so it's pretty convenient for us.
Link: https://github.com/prometheus/jmx_exporter On Fri, Aug 10, 2018 at 1:55 AM Ishwor Gurung <m...@ishworgurung.com.invalid> wrote: > I don’t know of Java-based solution but I have successfully used: > > Kafka JMX Exporter for Prometheus <———> Kafka > > to collect JMX metrics from Kafka. > > > On 10 Aug 2018, at 11:10 am, Raghav <raghavas...@gmail.com> wrote: > > > > Hi > > > > I found > > > https://github.com/kafka-dev/kafka/blob/master/perf/src/main/java/kafka/perf/jmx/BrokerJmxClient.java > > code > > written by Neha to pull JMX metrics via MBean. > > > > In here: > > > https://github.com/kafka-dev/kafka/blob/master/perf/src/main/java/kafka/perf/jmx/BrokerJmxClient.java#L37 > > there > > is a mention of object name (kafka:type=kafka.SocketServerStats) and > > subsequently SocketServerStatsMBean.class. > > > > My question is how to get these two for the latest Kafka 1.1. > > > > I want to write code in Java to get Kafka Stats exposed via JMX and then > > want to write to DB that our UI can read. > > > > Thanks. > > > > R > > > >> On Wed, Aug 8, 2018 at 6:46 PM, Raghav <raghavas...@gmail.com> wrote: > >> > >> Hi > >> > >> Is there any Java API available so that I can enable our Kafka cluster's > >> JMX port, and consume metrics via JMX api, and dump to a time series > >> database. > >> > >> I checked out jmxtrans, but currently it does not dump to TSDB (time > >> series database). > >> > >> Thanks. > >> > >> R > >> > > > > > > > > -- > > Raghav > >