Monitoring Cassandra Metrics using Grafana

vishalpaalakurthi - Nov 4 '20 - - Dev Community

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

. . . . . . . . . . .
Terabox Video Player