Cassandra exposes metrics via JMX and we collect them using a lightweight JMX connector - Jolokia, that you need to run alongside your cassandra instance (instructions below).

Our agent needs the Jolokia port and the username & password (if auth is enabled). If unspecified the default valued as below will be used.

The data.json entry for this plugin:

"cassandra": {
     "port" : 8778,
     "username": "",
     "password": ""

Having updated data.json on your server (no need to restart archagent), enable this plugin from the server's rule config page. Set thresholds for metrics that you care about and want to be alerted on. Enabling a plugin.

Setting up Jolokia

Download the stable release version of jolokia

# Find out the release version number of jolokia
jolokia_version=$(curl -s | grep "<release>" \
| sed "s/.*<release>\([^<]*\)<\/release>.*/\1/")

# Release version number of jolokia
echo "${jolokia_version}"

# Download the jolokia agent
curl "${jolokia_version}/jolokia-jvm-${jolokia_version}-agent.jar" \
-o "jolokia-jvm-${jolokia_version}-agent.jar"

# Your jolokia agent name
echo "jolokia-jvm-${jolokia_version}-agent.jar"

We will now connect the jolokia agent to cassandra.

Make sure $LOCAL_JMX is enabled in (it is enabled by default). This means JMX access is only possible from the localhost. If it is not, you need to enable it, and restart cassandra.

Now connect using the following command (to be run as the same user as the cassandra instance)

java -jar "jolokia-jvm-${jolokia_version}-agent.jar" start <pid_of_cassandra_instance>

If you see a Started Jolokia for PID ... message, we are done. If somehow, jolokia can't connect to cassandra, we'll need to restart cassandra with the jolokia agent, as detailed below.

Add jolokia agent to your cassandra installation

Move the already downloaded jolokia agent to the $CASSANDRA_HOME/lib folder. Now let cassandra know about it by adding the following line in the file (usually located at /etc/cassandra).

# Replace with your jolokia agent name as downloaded above.
[ -e "$CASSANDRA_HOME/lib/<your jolokia agent name>" ] && JVM_OPTS="$JVM_OPTS -javaagent:$CASSANDRA_HOME/lib/<your jolokia agent name>"

Restart cassandra.

results matching ""

    No results matching ""