I know we could use script to get partition count for a topic (reference), like following,
./kafka-topics.sh --describe --zookeeper localhost:2181 --topic topic_name
The result is
Topic:topic_name PartitionCount:2 ReplicationFactor:1 Configs:
Topic: topic_name Partition: 0 Leader: 0 Replicas: 0 Isr: 0
Topic: topic_name Partition: 1 Leader: 0 Replicas: 0 Isr: 0
How could we use JMX to monitor the number of partitions for a specific topic in one broker?