Skip to content
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.