Menu
Grafana Cloud

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. jmxUrl: service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi

Once deployed, Grafana Alloy instance should be able to reach the JMX Exporter’s exposed endpoint in order to scrape metrics.

Install Apache Cassandra integration for Grafana Cloud

  1. In your Grafana Cloud stack, click Connections in the left-hand menu.
  2. Find Apache Cassandra and click its tile to open the integration.
  3. 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.
  4. 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.

Configuration snippets for Grafana Alloy

Advanced mode

The following snippets provide examples to guide you through the configuration process.

To instruct Grafana Alloy to scrape your Apache Cassandra instances, manually copy and append the snippets to your alloy configuration file, then follow subsequent instructions.

Advanced metrics snippets

alloy
prometheus.scrape "metrics_integrations_integrations_apache_cassandra" {
	targets = concat(
		[{
			__address__       = "<your-jmx-exporter-hostname:9000>",
			cassandra_cluster = "<your-cluster-name>",
			cluster           = "<your-k8s-cluster-name>",
			instance          = constants.hostname,
		}],
		[{
			__address__       = "<your-jmx-exporter-hostname:9001>",
			cassandra_cluster = "<your-cluster-name>",
			cluster           = "<your-k8s-cluster-name>",
			instance          = constants.hostname,
		}],
		[{
			__address__       = "<your-jmx-exporter-hostname:9002>",
			cassandra_cluster = "<your-cluster-name>",
			cluster           = "<your-k8s-cluster-name>",
			instance          = constants.hostname,
		}],
	)
	forward_to = [prometheus.remote_write.metrics_service.receiver]
	job_name   = "integrations/apache-cassandra"
}

To monitor your Apache Cassandra instance, you must use a discovery.relabel component to discover your Apache Cassandra Prometheus endpoint and apply appropriate labels, followed by a prometheus.scrape component to scrape it.

Configure the following properties within each discovery.relabel component:

  • __address__: The address to your Apache Cassandra Prometheus metrics endpoint.
  • instance label: constants.hostname sets the instance label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this Apache Cassandra instance. Make sure this label value is the same for all telemetry data collected for this instance.
  • cassandra_cluster: The cassandra_cluster label to group your Apache Cassandra instances within a cluster. Set the same value for all nodes within your cluster.
  • cluster: if you are running your Cassandra instance within a k8s cluster, set the name of it to allow k8s cluster grouping.

If you have multiple Apache Cassandra servers to scrape, configure one discovery.relabel for each and scrape them by including each under targets within the prometheus.scrape component.

Advanced logs snippets

darwin

alloy
local.file_match "logs_integrations_integrations_apache_cassandra" {
	path_targets = [{
		__address__       = "localhost",
		__path__          = "/var/log/cassandra/system.log",
		cassandra_cluster = "<your-cluster-name>",
		cluster           = "<your-k8s-cluster-name>",
		instance          = constants.hostname,
		job               = "integrations/apache-cassandra",
	}]
}

loki.source.file "logs_integrations_integrations_apache_cassandra" {
	targets    = local.file_match.logs_integrations_integrations_apache_cassandra.targets
	forward_to = [loki.write.grafana_cloud_loki.receiver]
}

To monitor your Apache Cassandra instance logs, you will use a combination of the following components:

  • local.file_match defines where to find the log file to be scraped. Change the following properties according to your environment:

    • __address__: The Apache Cassandra instance address
    • __path__: The path to the log file.
    • instance label: constants.hostname sets the instance label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this Apache Cassandra instance. Make sure this label value is the same for all telemetry data collected for this instance.
    • cassandra_cluster: The cassandra_cluster label to group your Apache Cassandra instances within a cluster. Set the same value for all nodes within your cluster.
    • cluster: if you are running your Cassandra instance within a k8s cluster, set the name of it to allow k8s cluster grouping.
  • loki.source.file sends logs to Loki.

linux

alloy
local.file_match "logs_integrations_integrations_apache_cassandra" {
	path_targets = [{
		__address__       = "localhost",
		__path__          = "/var/log/cassandra/system.log",
		cassandra_cluster = "<your-cluster-name>",
		cluster           = "<your-k8s-cluster-name>",
		instance          = constants.hostname,
		job               = "integrations/apache-cassandra",
	}]
}

loki.source.file "logs_integrations_integrations_apache_cassandra" {
	targets    = local.file_match.logs_integrations_integrations_apache_cassandra.targets
	forward_to = [loki.write.grafana_cloud_loki.receiver]
}

To monitor your Apache Cassandra instance logs, you will use a combination of the following components:

  • local.file_match defines where to find the log file to be scraped. Change the following properties according to your environment:

    • __address__: The Apache Cassandra instance address
    • __path__: The path to the log file.
    • instance label: constants.hostname sets the instance label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this Apache Cassandra instance. Make sure this label value is the same for all telemetry data collected for this instance.
    • cassandra_cluster: The cassandra_cluster label to group your Apache Cassandra instances within a cluster. Set the same value for all nodes within your cluster.
    • cluster: if you are running your Cassandra instance within a k8s cluster, set the name of it to allow k8s cluster grouping.
  • loki.source.file sends logs to Loki.

windows

alloy
local.file_match "logs_integrations_integrations_apache_cassandra" {
	path_targets = [{
		__address__       = "localhost",
		__path__          = "/var/log/cassandra/system.log",
		cassandra_cluster = "<your-cluster-name>",
		cluster           = "<your-k8s-cluster-name>",
		instance          = constants.hostname,
		job               = "integrations/apache-cassandra",
	}]
}

loki.source.file "logs_integrations_integrations_apache_cassandra" {
	targets    = local.file_match.logs_integrations_integrations_apache_cassandra.targets
	forward_to = [loki.write.grafana_cloud_loki.receiver]
}

To monitor your Apache Cassandra instance logs, you will use a combination of the following components:

  • local.file_match defines where to find the log file to be scraped. Change the following properties according to your environment:

    • __address__: The Apache Cassandra instance address
    • __path__: The path to the log file.
    • instance label: constants.hostname sets the instance label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this Apache Cassandra instance. Make sure this label value is the same for all telemetry data collected for this instance.
    • cassandra_cluster: The cassandra_cluster label to group your Apache Cassandra instances within a cluster. Set the same value for all nodes within your cluster.
    • cluster: if you are running your Cassandra instance within a k8s cluster, set the name of it to allow k8s cluster grouping.
  • loki.source.file sends logs to Loki.

Grafana Agent static configuration (deprecated)

The following section shows configuration for running Grafana Agent in static mode which is deprecated. You should use Grafana Alloy for all new deployments.

Dashboards

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 1

Apache Cassandra overview 2

Apache Cassandra overview 2

Apache Cassandra nodes 1

Apache Cassandra nodes 1

Alerts

The Apache Cassandra integration includes the following useful alerts:

AlertDescription
HighReadLatencyCritical: There is a high level of read latency within the node.
HighWriteLatencyCritical: There is a high level of write latency within the node.
HighPendingCompactionTasksWarning: Compaction task queue is filling up.
BlockedCompactionTasksFoundCritical: Compaction task queue is full.
HintsStoredOnNodeWarning: Hints have been recently written to this node.
UnavailableWriteRequestsFoundCritical: Unavailable exceptions have been encountered while performing writes in this cluster.
HighCpuUsageCritical: A node has a CPU usage higher than the configured threshold.
HighMemoryUsageCritical: A node has a higher memory utilization than the configured threshold.

Metrics

The most important metrics provided by the Apache Cassandra integration, which are used on the pre-built dashboards and Prometheus alerts, are as follows:

  • cassandra_cache_hitrate
  • cassandra_cache_size
  • cassandra_clientrequest_latency_seconds_count
  • cassandra_clientrequest_timeouts_count
  • cassandra_clientrequest_unavailables_count
  • cassandra_compaction_pendingtasks
  • cassandra_connection_largemessageactivetasks
  • cassandra_connection_largemessagedroppedtasks
  • cassandra_connection_largemessagependingtasks
  • cassandra_connection_smallmessageactivetasks
  • cassandra_connection_smallmessagedroppedtasks
  • cassandra_connection_smallmessagependingtasks
  • cassandra_connection_timeouts_count
  • cassandra_down_endpoint_count
  • cassandra_keyspace_caspreparelatency_seconds
  • cassandra_keyspace_pendingcompactions
  • cassandra_keyspace_readlatency_seconds
  • cassandra_keyspace_readlatency_seconds_average
  • cassandra_keyspace_readlatency_seconds_count
  • cassandra_keyspace_repairjobscompleted_count
  • cassandra_keyspace_repairjobsstarted_count
  • cassandra_keyspace_totaldiskspaceused
  • cassandra_keyspace_writelatency_seconds
  • cassandra_keyspace_writelatency_seconds_average
  • cassandra_keyspace_writelatency_seconds_count
  • cassandra_keyspace_writelatency_seconds_sum
  • cassandra_messaging_crossnodelatency_seconds
  • cassandra_storage_load_count
  • cassandra_storage_totalhints_count
  • cassandra_table_maxpartitionsize
  • cassandra_table_readlatency_seconds_count
  • cassandra_table_readlatency_seconds_sum
  • cassandra_threadpools_currentlyblockedtasks_count
  • cassandra_up_endpoint_count
  • jvm_gc_collection_count
  • jvm_gc_duration_seconds
  • jvm_memory_usage_used_bytes
  • jvm_physical_memory_size
  • jvm_process_cpu_load
  • up

Changelog

md
# 1.0.2 - April 2024

* Updated to latest mixin to fix the Hints Stored alert

# 1.0.1 - March 2024

* Updated to latest Mixin to fix CPU and Memory Alert queries

# 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

Cost

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.