TaiJuWu commented on PR #19300: URL: https://github.com/apache/kafka/pull/19300#issuecomment-2760243119
``` #!/bin/bash # set Kafka JMX port(need to set by manual) JMX_PORT=9999 JMXTERM_JAR="jmxterm.jar" if [ ! -f "$JMXTERM_JAR" ]; then echo "🔍 jmxterm.jar is not existing,downloading..." wget -q https://github.com/jiaqi/jmxterm/releases/download/v1.0.2/jmxterm-1.0.2-uber.jar -O "$JMXTERM_JAR" echo "✅ jmxterm.jar download finish" fi # generate jmxterm command CMD=$(cat <<EOF open localhost:$JMX_PORT beans EOF ) echo "🔍 try getting Kafka Consumer 的 JMX metric..." MBeans=$(echo "$CMD" | java -jar "$JMXTERM_JAR" | awk '{print $1}') # iterator Kafka Consumer MBean, list all metrics name for bean in $MBeans; do echo "----------------------------------------" echo "📌 Kafka Consumer JMX metric: $bean" CMD=$(cat <<EOF open localhost:$JMX_PORT domain kafka.consumer bean $bean info EOF ) echo "$CMD" | java -jar "$JMXTERM_JAR" | grep " - " | sed 's/ - / 🔹 /g' done echo "✅ Kafka Consumer JMX read finish!" ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org