Cassandra monitoring with telegraf (&jolokia-agent), prometheus and grafana on ubuntu 16.04/18.04/20.04 LTS


 

In this post, We will install and configure Cassandra monitoring with telegraf using jolokia agent on ubuntu 18.04 LTS.

 

I believe that you already installed and configure Prometheus, Grafana and Telegraf on ubuntu if not so then you use the given useful link for the same.

 

https://www.techbeginner.in/2020/12/how-to-install-prometheus-on-ubuntu.html
https://www.techbeginner.in/2021/01/how-to-install-telegraf-on-ubuntu-1804.html


Step 1: Installing Cassandra
 

You need to update the ubuntu current repository by using the given command.

sudo apt-get update

After that we need to install Java 8 by following the command.

sudo apt-get install openjdk-8-jdk -y

Now you are ready to install some packages which is required, Execute the given command for the same.

sudo apt-get install software-properties-common build-essential -y 

Add the cassandra key by using the given command.

sudo wget -q -O - https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -

Add the Cassandra repository by using the given command. 

sudo sh -c 'echo "deb http://www.apache.org/dist/cassandra/debian 311x main" > /etc/apt/sources.list.d/cassandra.list'

 

Its time update the ubuntu repository to update Cassandra.

sudo apt-get update

 

Install the Cassandra package by execution the given command.

sudo apt-get install cassandra -y

Verify the Cassandra service status by using the given command.

sudo systemctl status cassandra


Step 2: Jolokia Agent Integration
 

You need to create a directory to download a jolokia package or you can choose directory as per your requirment, Use the following command for the same.

mkdir /opt/jolokia

Download the Jolokia packages by using wget command in /opt/jolokia directory 

cd /opt/jolokia
wget https://github.com/rhuss/jolokia/releases/download/v1.4.0/jolokia-1.4.0-bin.tar.gz

Once the jolokia packages downloaded So then you need to extract it using tar cli.

tar -xzvf jolokia-1.4.0-bin.tar.gz

Add the Jolokia configuration in Cassandra-env.sh file by using the given command.

echo 'JVM_OPTS="$JVM_OPTS -javaagent:/opt/jolokia/jolokia-1.4.0/agents/jolokia-jvm.jar"' >> /etc/cassandra/cassandra-env.sh

Now you need to execuite following command and restart the cassandra to get changes.

nodetool flush
nodetool drain
sudo service cassandra restart

Verify the Cassandra service status

sudo service cassandra restart


Step 3: Telegraf Configuration
 

Here you need to create a cassandra.conf file in /etc/telegraf.d/ path uisng given command.

sudo vim /etc/telegraf/telegraf.d/cassandra.conf

and paste the given configuration.


[[inputs.cassandra]]
  context = "/jolokia/read"
  servers = [":8778"]
  metrics = ["/java.lang:type=Memory/HeapMemoryUsage"]

 

Save and exit from the vim text editor and restart the telegraf service to get cassandra metric.

sudo systemctl restrat telegraf

Conclusion

We have successfully configured Jolokia agent with cassandra to get cassandra metric with telegraf , Still you are facing same issue then leave a comment with your problem to get better support.


Cassandra monitoring with telegraf (&jolokia-agent), prometheus and grafana on ubuntu 16.04/18.04/20.04 LTS

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top