Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ccm helper script more generic #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
32 changes: 32 additions & 0 deletions bin/install-ccm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

shopt -s extglob

SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
CCM_CONFIG=${CCM_CONFIG_DIR:=~/.ccm}
JAR_FILE=$(eval echo "${SCRIPT_PATH}/../agent/target/cassandra-exporter-agent-*.jar")

if [ ! -f ${CCM_CONFIG}/CURRENT ]; then
echo "Unable to find an active ccm cluster"
exit 2
fi

if [ ! -f ${JAR_FILE} ]; then
echo "No jar file found. Build project and try again."
exit 3
fi

CCM_CLUSTER_NAME=`cat ${CCM_CONFIG}/CURRENT`
echo "Installing cassandra-exporter into ${CCM_CLUSTER_NAME}"

CLUSTER_PATH=${CCM_CONFIG}/${CCM_CLUSTER_NAME}

find ${CLUSTER_PATH} -path '*/node*/conf/cassandra-env.sh' | while read file; do
node=$(echo ${file} | sed 's/[^0-9]*//g')
port=$((19499+${node}))

echo " http://127.0.0.${node}:${port}/metrics"
sed -i -e "/cassandra-exporter/d" "${file}"

echo "JVM_OPTS=\"\$JVM_OPTS -javaagent:${JAR_FILE}=--listen=:${port},--enable-collector-timing\"" >> "${file}"
done;
12 changes: 0 additions & 12 deletions install-ccm.sh

This file was deleted.