From 5e56190b1636c5908707d9d17e19749c2828b1de Mon Sep 17 00:00:00 2001 From: Binayak Pokharel Date: Thu, 21 Nov 2024 11:03:35 +1100 Subject: [PATCH] capitalization and minor name fixes --- kafka/README.md | 12 ++++++------ kafka/cluster_collector.sh | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/kafka/README.md b/kafka/README.md index f21ce6f..2248f39 100644 --- a/kafka/README.md +++ b/kafka/README.md @@ -7,21 +7,21 @@ Note: * The term "VM" in environment of script `cluster_collector.sh` means if running in kernel. # Design info: -There are two scripts used in instacollector tool for kafka. +There are two scripts used in instacollector tool for Kafka. 1. `node_collector.sh`: supposed to be executed on each Kafka node. It executes Linux and Kafka commands and copies configuration and log files required for cluster health checks. The user needs to modify the `KAFKA_HOME` path inside the script as per their configurations, the default value used is: ``` KAFKA_HOME=/opt/kafka ``` -2. `cluster_collector.sh`: to be executed on a machine connected to Kafka cluster e.g. user laptop with a running docker or a running VM. It executes node_collector.sh on each Kafka node using ssh. The cluster_collector.sh requires 4 user inputs : +2. `cluster_collector.sh`: to be executed on a machine connected to Kafka cluster e.g. user laptop with a running Docker or a running VM. It executes node_collector.sh on each Kafka node using ssh. The cluster_collector.sh requires 4 user inputs : ``` - * Enter your kafka environment (vm/docker) : + * Enter your kafka environment (VM/Docker) : * [If VM] * Enter username for login on Kafka cluster nodes (Press Enter for default admin) : * Enter Identity file path: (the ssh key file in your local machine which is used to connect to the VMs) - * [If docker] - * Enter docker home directory: - * Enter path of the command config file: (kafka command-config file location on the kafka brokers) + * [If Docker] + * Enter Docker home directory: + * Enter path of the command config file: (Kafka command-config file location on the Kafka brokers) * Enter file containing ip addresses/host/container names of Kafka cluster nodes: (the hosts file in your local machine) ``` ******************* diff --git a/kafka/cluster_collector.sh b/kafka/cluster_collector.sh index d862ab0..01440fc 100755 --- a/kafka/cluster_collector.sh +++ b/kafka/cluster_collector.sh @@ -56,12 +56,12 @@ clear SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" INFO_DIR=/tmp/InstaCollection_$(date +%Y%m%d%H%M) -#Collect environment info (VM/docker) -read -p "Enter your kafka environment (vm/docker) :" kenv +#Collect environment info (VM/Docker) +read -p "Enter your Kafka environment (SSH/Docker) :" kenv -if [[ "${kenv}" == "vm" ]]; then +if [[ "${kenv}" == "SSH" ]]; then #Collect user info. - read -p "Enter username for login on Kafka cluster nodes (Press Enter for default admin) :" user + read -p "Enter SSH username for login on Kafka cluster nodes (Press Enter for default admin) :" user [ -z "${user}" ] && user='admin' #user='rahulchakrabarty' @@ -73,11 +73,11 @@ if [[ "${kenv}" == "vm" ]]; then fi #id_file='/Users/rahulchakrabarty-instaclustr/.ssh/rahulchakrabarty-instaclustr' -elif [[ "${kenv}" == "docker" ]]; then - read -p "Enter docker home directory :" docker_home +elif [[ "${kenv}" == "Docker" ]]; then + read -p "Enter directory path to store the output:" docker_home - if [ -z "$docker_home" ]; then - echo "Docker home directory cannot be empty" + if [ -z "docker_directory" ]; then + echo "Provided directory cannot be empty" exit 1 fi else @@ -98,7 +98,7 @@ fi echo "environment $kenv" #Execute the node_collector on each node or container -if [ "$kenv" == "vm" ]; then +if [ "$kenv" == "SSH" ]; then while read peer do if [[ -z "$peer" ]]; then @@ -113,8 +113,8 @@ else break fi echo "Copying file node_collector.sh to container" - docker cp ./node_collector.sh $peer:$docker_home/ - docker exec $peer /bin/bash -c "sh $docker_home/node_collector.sh $peer $config_file" & + docker cp ./node_collector.sh $peer:docker_directory/ + docker exec $peer /bin/bash -c "sh docker_directory/node_collector.sh $peer $config_file" & done < "$peers_file" fi