---
title: "Apache Cassandra integration | Grafana Cloud documentation"
description: "Learn about Apache Cassandra Grafana Cloud integration."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# 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 4 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](https://github.com/prometheus/jmx_exporter) on each node in your cluster. Prefer the [Java agent](https://github.com/prometheus/jmx_exporter#java-agent) attached to each Cassandra JVM instead of the [standalone exporter](https://prometheus.github.io/jmx_exporter/1.1.0/standalone/), which connects over remote JMX and is more complex to configure.

#### Set up JMX Exporter

Use this [Apache Cassandra JMX Exporter configuration file](https://storage.googleapis.com/grafanalabs-integration-assets/apache-cassandra/files/cassandra.yml) with the Java agent, and choose an HTTP listen port for metrics so each node serves `/metrics` at an address your scraper can reach.

For JVM options and agent arguments, see the [JMX Exporter documentation](https://github.com/prometheus/jmx_exporter#jmx-exporter).

Once deployed, Grafana Alloy should be able to reach the JMX Exporter HTTP endpoint on each node 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 Alloy 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 ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```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](/docs/alloy/latest/reference/components/discovery.relabel/) component to discover your Apache Cassandra Prometheus endpoint and apply appropriate labels, followed by a [prometheus.scrape](/docs/alloy/latest/reference/components/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 ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```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](/docs/alloy/latest/reference/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](/docs/alloy/latest/reference/components/loki.source.file) sends logs to Loki.

#### linux

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```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](/docs/alloy/latest/reference/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](/docs/alloy/latest/reference/components/loki.source.file) sends logs to Loki.

#### windows

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```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](/docs/alloy/latest/reference/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](/docs/alloy/latest/reference/components/loki.source.file) sends logs to Loki.

## Kubernetes instructions

Instructions for Kubernetes

### Before you begin with Kubernetes

**Please note**: These instructions assume the use of the [Kubernetes Monitoring Helm chart](https://github.com/grafana/k8s-monitoring-helm)

In order for the integration to properly work, you must set up the [JMX Exporter for Prometheus](https://github.com/prometheus/jmx_exporter) on each node in your cluster. Prefer the [Java agent](https://github.com/prometheus/jmx_exporter#java-agent) attached to each Cassandra JVM instead of the [standalone exporter](https://prometheus.github.io/jmx_exporter/1.1.0/standalone/), which connects over remote JMX and is more complex to configure.

#### Set up JMX Exporter

Use this [Apache Cassandra JMX Exporter configuration file](https://storage.googleapis.com/grafanalabs-integration-assets/apache-cassandra/files/cassandra.yml) with the Java agent, and choose an HTTP listen port for metrics so each node serves `/metrics` at an address your scraper can reach.

For JVM options and agent arguments, see the [JMX Exporter documentation](https://github.com/prometheus/jmx_exporter#jmx-exporter).

Once deployed, ensure your Kubernetes monitoring stack can reach the JMX Exporter HTTP endpoint on each Cassandra instance.

### Configuration snippets for Kubernetes Helm chart

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

To scrape your Apache Cassandra instances, **manually** modify your Kubernetes Monitoring Helm chart with these configuration snippets.

Replace any values between the angle brackets `<>` in the provided snippets with your desired configuration values.

#### Metrics snippets

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
alloy-metrics:
    extraConfig: |-
        discovery.kubernetes "apache_cassandra" {
            role = "pod"
            selectors {
                role = "pod"
                label = "<apache_cassandra_pod_label>=<apache_cassandra_pod_label_value>"
            }
        }
        
        discovery.relabel "apache_cassandra" {
            targets = discovery.kubernetes.apache_cassandra.targets
            rule {
                source_labels = ["__meta_kubernetes_pod_container_port_number"]
                regex = "<apache_cassandra_jmx_port_number>"
                action = "keep"
            }
            rule {
                source_labels = ["__meta_kubernetes_namespace", "__meta_kubernetes_pod_container_name"]
                separator = "-"
                target_label = "instance"
            }
            rule {
                replacement = "<your-cassandra-cluster-name>"
                target_label = "cassandra_cluster"
            }
            rule {
                replacement = "integrations/apache-cassandra"
                target_label = "job"
            }
        }
        
        prometheus.scrape "metrics_apache_cassandra" {
            targets      = discovery.relabel.apache_cassandra.output
            honor_labels = true
            forward_to   = [prometheus.remote_write.grafana_cloud_metrics.receiver]
        }
```

#### Logs snippets

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
podLogs:
    extraDiscoveryRules: |-
        rule {
            source_labels = ["__meta_kubernetes_pod_label_<apache_cassandra_pod_label>"]
            regex = "<apache_cassandra_pod_label_value>"
            replacement = "apache_cassandra"
            target_label = "integration"
        }

    extraLogProcessingStages: |-
        stage.match {
            selector = "{integration=\\"apache_cassandra\\"}"
            
            stage.template {
                source   = "instance"
                template = "{{ .namespace }}-{{ .container }}"
            }

            stage.static_labels {
                values = {
                    cassandra_cluster = "<your-cassandra-cluster-name>",
                    job               = "integrations/apache-cassandra",
                }
            }

            stage.labels {
                values = {
                    instance = null,
                }
            }
        }
```

## Dashboards

The Apache Cassandra integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.

- Apache Cassandra keyspaces
- Apache Cassandra logs
- Apache Cassandra nodes
- Apache Cassandra overview

**Apache Cassandra overview 1**

**Apache Cassandra overview 2**

**Apache Cassandra nodes 1**

## Alerts

The Apache Cassandra integration includes the following useful alerts:

Expand table

| Alert                         | Description                                                                                     |
|-------------------------------|-------------------------------------------------------------------------------------------------|
| 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.                 |

## 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\_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\_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 ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```md
# 1.1.0 - April 2026

* Updated dashboards to follow new stylistic standards

# 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](/docs/grafana-cloud/fundamentals/active-series-and-dpm/) and [Cloud tier pricing](/products/cloud/pricing/).
