Apache Cassandra integration for Grafana Cloud
Apache Cassandra is an open source NoSQL distributed database. This integration for Grafana Cloud allows users to collect metrics and system logs for monitoring an Apache Cassandra instance or clustered deployment.
Metrics include number of nodes in a cluster, virtual memory and cpu usage, read/write latencies, compaction tasks, and garbage collections. It includes useful visualizations for cluster, node, and keyspace metrics.
This integration includes 8 useful alerts and 3 pre-built dashboards to help monitor and visualize Apache Cassandra metrics and logs.
Before you begin
In order for the integration to properly work, you must set up the JMX Exporter for Prometheus on each node in your cluster.
Set up JMX Exporter
Each instance of the JMX Exporter can be run with this Apache Cassandra JMX Exporter configuration file.
For more information on how to configure the JVM on each node, please refer to the JMX Exporter documentation for further configuration details.
Apache Cassandra nodes by default expose
7199 for JMX by default, please make sure the port matches your environment. The JMX URL for the exporter should be properly configured to match your environment e.g.
Once deployed, the Grafana Agent should be able to reach the JMX Exporter’s exposed endpoint in order to scrape metrics.
Install Apache Cassandra integration for Grafana Cloud
- In your Grafana Cloud stack, click Connections in the left-hand menu.
- Find Apache Cassandra and click its tile to open the integration.
- Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send Apache Cassandra metrics and logs to your Grafana Cloud instance.
- Click Install to add this integration’s pre-built dashboards and alerts to your Grafana Cloud instance, and you can start monitoring your Apache Cassandra setup.
Post-install configuration for the Apache Cassandra integration
After enabling the metrics generation, instruct the Grafana Agent to scrape your Apache Cassandra nodes.
Make sure to change
targets in the snippet according to your environment.
You must configure a custom label for this integration:
cluster, the value that identifies a Apache Cassandra cluster
You can define a cluster label by adding an extra label to the scrape_configs of the JMX Exporter.
If you want to show logs and metrics signals correlated in your dashboards as a single pane of glass, ensure the following:
instancelabel values must match for the Apache Cassandra integration and logs scrape config in your agent configuration file.
jobmust be set to
instancelabel must be set to a value that uniquely identifies your Apache Cassandra node. Please replace the default hostname value according to your environment - it should be set manually. Note that if you use localhost for multiple nodes, the dashboards will not be able to filter correctly by instance.
clustermust be the value that identifies the Apache Cassandra Cluster this node belongs to.
metrics: configs: - scrape_configs: - job_name: integrations/apache-cassandra static_configs: - targets: - '<node1>:<exporter-port>' - '<node2>:<exporter-port>' - '<node3>:<exporter-port>' labels: cluster: '<your-cluster-name>' logs: configs: scrape_configs: - job_name: integrations/apache-cassandra static_configs: - targets: [localhost] labels: job: integrations/apache-cassandra instance: '<your-instance-name>:<exporter-port>' cluster: '<your-cluster-name>' __path__: /var/log/cassandra/system.log
Configuration snippets for Grafana Agent
metrics.configs.scrape_configs, insert the following lines and change the URLs according to your environment:
- job_name: integrations/apache-cassandra metrics_path: "/metrics" static_configs: - targets: - '<your-jmx-exporter-hostname:9000>' - '<your-jmx-exporter-hostname:9001>' - '<your-jmx-exporter-hostname:9002>' labels: cassandra_cluster: '<your-cluster-name>' cluster: '<your-k8s-cluster-name>' instance: '<your-instance-name>'
logs.configs.scrape_configs, insert the following lines according to your environment.
- job_name: integrations/apache-cassandra static_configs: - targets: [localhost] labels: job: integrations/apache-cassandra instance: '<your-instance-name>' cassandra_cluster: <your-cluster-name> cluster: '<your-k8s-cluster-name>' __path__: /var/log/cassandra/system.log
Full example configuration for Grafana Agent
Refer to the following Grafana Agent configuration for a complete example that contains all the snippets used for the Apache Cassandra integration. This example also includes metrics that are sent to monitor your Grafana Agent instance.
integrations: prometheus_remote_write: - basic_auth: password: <your_prom_pass> username: <your_prom_user> url: <your_prom_url> agent: enabled: true relabel_configs: - action: replace source_labels: - agent_hostname target_label: instance - action: replace target_label: job replacement: "integrations/agent-check" metric_relabel_configs: - action: keep regex: (prometheus_target_.*|prometheus_sd_discovered_targets|agent_build.*|agent_wal_samples_appended_total|process_start_time_seconds) source_labels: - __name__ # Add here any snippet that belongs to the `integrations` section. # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line. logs: configs: - clients: - basic_auth: password: <your_loki_pass> username: <your_loki_user> url: <your_loki_url> name: integrations positions: filename: /tmp/positions.yaml scrape_configs: # Add here any snippet that belongs to the `logs.configs.scrape_configs` section. # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line. - job_name: integrations/apache-cassandra static_configs: - targets: [localhost] labels: job: integrations/apache-cassandra instance: '<your-instance-name>' cassandra_cluster: <your-cluster-name> cluster: '<your-k8s-cluster-name>' __path__: /var/log/cassandra/system.log metrics: configs: - name: integrations remote_write: - basic_auth: password: <your_prom_pass> username: <your_prom_user> url: <your_prom_url> scrape_configs: # Add here any snippet that belongs to the `metrics.configs.scrape_configs` section. # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line. - job_name: integrations/apache-cassandra metrics_path: "/metrics" static_configs: - targets: - '<your-jmx-exporter-hostname:9000>' - '<your-jmx-exporter-hostname:9001>' - '<your-jmx-exporter-hostname:9002>' labels: cassandra_cluster: '<your-cluster-name>' cluster: '<your-k8s-cluster-name>' instance: '<your-instance-name>' global: scrape_interval: 60s wal_directory: /tmp/grafana-agent-wal
The Apache Cassandra integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.
- Apache Cassandra keyspaces
- Apache Cassandra nodes
- Apache Cassandra overview
Apache Cassandra overview 1
Apache Cassandra overview 2
Apache Cassandra nodes 1
The Apache Cassandra integration includes the following useful alerts:
|HighReadLatency||Critical: There is a high level of read latency within the node.|
|HighWriteLatency||Critical: There is a high level of write latency within the node.|
|HighPendingCompactionTasks||Warning: Compaction task queue is filling up.|
|BlockedCompactionTasksFound||Critical: Compaction task queue is full.|
|HintsStoredOnNode||Warning: Hints have been recently written to this node.|
|UnavailableWriteRequestsFound||Critical: Unavailable exceptions have been encountered while performing writes in this cluster.|
|HighCpuUsage||Critical: A node has a CPU usage higher than the configured threshold.|
|HighMemoryUsage||Critical: A node has a higher memory utilization than the configured threshold.|
The most important metrics provided by the Apache Cassandra integration, which are used on the pre-built dashboards and Prometheus alerts, are as follows:
# 1.0.0 - October 2023 * Updated existing cluster label to casandra_cluster label * Added Grafana Agent Operator configuration snippet to support Apache Cassandra in kubernetes cluster * Added cluster selector to dashboard for kubernetes support * Added default cluster label to agent config * Bump version to 1.0.0 # 0.0.3 - September 2023 * New Filter Metrics option for configuring the Grafana Agent, which saves on metrics cost by dropping any metric not used by this integration. Beware that anything custom built using metrics that are not on the snippet will stop working. * New hostname relabel option, which applies the instance name you write on the text box to the Grafana Agent configuration snippets, making it easier and less error prone to configure this mandatory label. # 0.0.2 - August 2023 * Add regex filter for logs datasource # 0.0.1 - March 2023 * Initial release
By connecting your Apache Cassandra instance to Grafana Cloud, you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see Active series and dpm usage and Cloud tier pricing.