-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkafka-helper.sh
More file actions
executable file
·36 lines (30 loc) · 1003 Bytes
/
Copy pathkafka-helper.sh
File metadata and controls
executable file
·36 lines (30 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# sudo su - kafka
kafka_host="kafka1:9092"
BASEDIR=$(dirname "$0")
cd $BASEDIR
list_group=(`bin/kafka-consumer-groups.sh --bootstrap-server $kafka_host --list | sort`)
if [[ ! -z $1 ]]; then
group_name=${list_group[$1]}
echo "You selected: $group_name"
bin/kafka-consumer-groups.sh --bootstrap-server $kafka_host --describe --group $group_name
else
i=0
for group in ${list_group[@]}; do
echo "$i. $group"
i=$((i+1))
done
echo ""
read -e -p "Enter index group: (-1: show all): " index
if [[ $index == -1 ]]; then
for group in ${list_group[@]}; do
echo "---------- $group ----------"
bin/kafka-consumer-groups.sh --bootstrap-server $kafka_host --describe --group $group
echo ""
done
else
group_name=${list_group[$index]}
echo "You selected: $group_name"
bin/kafka-consumer-groups.sh --bootstrap-server $kafka_host --describe --group $group_name
fi
fi