This is a "one liner" shell command to list all partitions with not in-synch replicas (i.e. with a list of in-synch replicas not matching the list of replicas).
Please set ZK
variable accordingly.
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --zookeeper $ZK --describe | grep "Isr: " | while read line;
do
replicas=$(echo $line | sed -e "s/.*Replicas: \([^ ]*\).*/\1/" -e "s/,/\n/g" | sort -n | paste -sd ",");
isr=$(echo $line | sed -e "s/.*Isr: \([^ ]*\).*/\1/" -e "s/,/\n/g" | sort -n | paste -sd ",");