DEV Community

Cover image for Monitoring Cassandra Metrics using Grafana
vishalpaalakurthi
vishalpaalakurthi

Posted on • Edited on

3

Monitoring Cassandra Metrics using Grafana

Prerequisites

  1. jmx_prometheus_javaagent. (https://mvnrepository.com/artifact/io.prometheus.jmx/jmx_prometheus_javaagent/0.14.0)
  2. Sample cassandra.yml configuration for jmx_prometheus_javaagent. (https://raw.githubusercontent.com/prometheus/jmx_exporter/master/example_configs/cassandra.yml)
  3. Prometheus server. (https://prometheus.io/download/)
  4. Grafana Server. (https://grafana.com/grafana/download)

Steps to follow

  1. Download jmx_prometheus_javaagent jar file.
  2. Download cassandra.yml configuration file for producing jvm and cassandra metrics.
  3. Add JVM_OPTS to cassandra-env.sh file.
  4. JVM_OPTS="$JVM_OPTS javaagent:/etc/cassandra/jmx_prometheus_javaagent-0.10.jar=7070:/etc/cassandra/cassandra.yml"
  5. Restart cassandra server. http://localhost:7070/metrics, this URL provides JVM and cassandra Metrics.
  6. Download Prometheus server.
  7. Add below lines to prometheus.yml for Prometheus server configuration.job_name: ‘cassandra’static_configs:
    • targets: [‘ip:7070’]
  8. Download Grafana Server.
  9. Setup Prometheus data source to Grafana.
  10. Create Metrics dashboard using provided queries in Grafana.
  11. Grafana dashboard is exposed to localhost:3000.
  12. Prometheus server exposed to localhost:9090.

Notes

  1. jmx_prometheus_javaagent is to be added to each cassandra node.

Architecture

Alt Text

How it works

Prometheus scrapes metrics from instrumented jobs, either directly or via an intermediary push gateway for short-lived jobs. It stores all scraped samples locally and runs rules over this data to either aggregate and record new time series from existing data or generate alerts. Grafana or other API consumers can be used to visualize the collected data.

References

  1. Steps for setting up Cassandra metrics through grafana. (https://community.grafana.com/t/how-to-connect-prometheus-to-cassandra/1153/11)
  2. https://grafana.com/docs/grafana/latest/
  3. https://github.com/prometheus/prometheus
  4. https://prometheus.io/docs/introduction/overview/

Sample Image

Alt Text

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (1)

Collapse
 
rahuljuspay profile image
rahulJuspay

Error opening zip file or JAR manifest missing : '/home/rahul/jmx_prometheus_javaagent-0.17.2.jar

How to fix this?

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay