Plugins 〉Apache Cassandra
Cassandra DataSource for Grafana
Apache Cassandra Datasource for Grafana. This datasource is to visualise time-series data stored in Cassandra/DSE, if you are looking for Cassandra metrics, you may need datastax/metric-collector-for-apache-cassandra instead.
To see the datasource in action, please follow the Quick Demo steps.
- Grafana 5.x, 6.x, 7.x (4.x not tested)
- Cassandra 3.x (4.x experimental, 2.x not tested)
- DataStax Enterprise 6.x
- DataStax Astra (docs)
- AWS Keyspaces (limited support) (docs)
- Linux, OSX, Windows
You can find more detailed instructions in the datasource wiki.
Download the plugin using latest release, please download
cassandra-datasource-VERSION.tar.gzand uncompress a file into the Grafana plugins directory (
The plugin is yet unsigned by Grafana (WiP #58) so it may require additional step to enable the plugin if you are using Grafana 7.x:
2.1. If you use a local version, enable plugin in
[plugins] allow_loading_unsigned_plugins = "hadesarchitect-cassandra-datasource"
2.2 If you use dockerized Grafana, you need to set environment variable
Add the Cassandra DataSource as a datasource at the datasource configuration page.
Configure the datasource specifying contact point and port like "10.11.12.13:9042", username and password, skip the keyspace. It's recommended to use a dedicated user with read-only permissions only to the table you have to access.
Push the "Save and Test" button, if there is an error message, check the credentials and connection.
<img src="https://user-images.githubusercontent.com/1742301/103153542-8a3cc300-4791-11eb-9479-4a2e3ec94463.png" width="500">
There are two ways to query data from Cassandra/DSE, Query Configurator and Query Editor. Configurator is easier to use but has limited capabilities, Editor is more powerful but requires understanding of CQL.
<img src="https://user-images.githubusercontent.com/1742301/103153577-d12ab880-4791-11eb-9a6b-50c86423134d.png" width="500">
Query Configurator is the easiest way to query data. At first, enter the keyspace and table name, then pick proper columns. If keyspace and table names are given correctly, the datasource will suggest the column names automatically.
- Time Column - the column storing the timestamp value, it's used to answer "when" question.
- Value Column - the column storing the value you'd like to show. It can be the
temperatureor whatever property you need.
- ID Column - the column to uniquely identify the source of the data, e.g.
shop_idor whatever allows you to identify the origin of data.
After that, you have to specify the
ID Value, the particular ID of the data origin you want to show. You may need to enable "ALLOW FILTERING" although we recommend to avoid it.
Example Imagine you want to visualise reports of a temperature sensor installed in your smart home. Given the sensor reports its ID, time, location and temperature every minute, we create a table to store the data and put some values there:
CREATE TABLE IF NOT EXISTS temperature ( sensor_id uuid, registered_at timestamp, temperature int, location text, PRIMARY KEY ((sensor_id), registered_at) );
insert into temperature (sensor_id, registered_at, temperature, location) values (99051fe9-6a9c-46c2-b949-38ef78858dd0, 2020-04-01T11:21:59.001+0000, 18, "kitchen"); insert into temperature (sensor_id, registered_at, temperature, location) values (99051fe9-6a9c-46c2-b949-38ef78858dd0, 2020-04-01T11:22:59.001+0000, 19, "kitchen"); insert into temperature (sensor_id, registered_at, temperature, location) values (99051fe9-6a9c-46c2-b949-38ef78858dd0, 2020-04-01T11:23:59.001+0000, 20, "kitchen");
In this case, we have to fill the configurator fields the following way to get the results:
- Keyspace - smarthome (keyspace name)
- Table - temperature (table name)
- Time Column - registered_at (occurence)
- Value Column - temperature (value to show)
- ID Column - sensor_id (ID of the data origin)
- ID Value - 99051fe9-6a9c-46c2-b949-38ef78858dd0 ID of the sensor
- ALLOW FILTERING - FALSE (not required, so we are happy to avoid)
In case of a few origins (multiple sensors) you will need to add more rows. If your case is as simple as that, query configurator will be a good choice, otherwise please proceed to the query editor.
Query Editor is more powerful way to query data. To enable query editor, press "toggle text edit mode" button.
<img src="https://user-images.githubusercontent.com/1742301/102781863-a8bd4b80-4398-11eb-8c28-4d06a1f29279.png" width="300">
Query Editor unlocks all possibilities of CQL including Used-Defined Functions, aggregations etc.
Example using test_data.cql:
SELECT id, CAST(value as double), created_at FROM test.test WHERE id IN (99051fe9-6a9c-46c2-b949-38ef78858dd1, 99051fe9-6a9c-46c2-b949-38ef78858dd0) AND created_at > $__timeFrom and created_at < $__timeTo
- Follow the order of the SELECT expressions, it's important!
- Identifier - the first property in the SELECT expression must be the ID, something that uniquely identifies the data (e.g.
- Value - The second property must be the value what you are going to show
- Timestamp - The third value must be timestamp of the value. All other properties will be ignored
- To filter data by time, use
$__timeToplaceholders as in the example. The datasource will replace them with time values from the panel. Notice It's important to add the placeholders otherwise query will try to fetch data for the whole period of time. Don't try to specify the timeframe on your own, just put the placeholders. It's grafana's job to specify time limits.
<img src="https://user-images.githubusercontent.com/1742301/103153625-1fd85280-4792-11eb-9c00-085297802117.png" width="500">
Installing Apache Cassandra on Grafana Cloud:
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
For more information, visit the docs on plugin installation.
Installing on a local Grafana:
For local instances, plugins are installed and updated via a simple CLI command. Plugins are not updated automatically, however you will be notified when updates are available right within your Grafana.
1. Install the Data Source
Use the grafana-cli tool to install Apache Cassandra from the commandline:
grafana-cli plugins install
The plugin will be installed into your grafana plugins directory; the default is /var/lib/grafana/plugins. More information on the cli tool.
Alternatively, you can manually download the .zip file for your architecture below and unpack it into your grafana plugins directory.
Alternatively, you can manually download the .zip file and unpack it into your grafana plugins directory.
2. Configure the Data Source
Accessed from the Grafana main menu, newly installed data sources can be added immediately within the Data Sources section.
Next, click the Add data source button in the upper right. The data source will be available for selection in the Type select box.
To see a list of installed data sources, click the Plugins item in the main menu. Both core data sources and installed data sources will appear.
Visualize Humio logs alongside your other data sources in Grafana Cloud with the new plugin for Grafana
Blog post 5 min
Monitor your production line with the new Grafana Enterprise data source plugin for SAP HANA®
Blog post 5 min
What’s new in Grafana Enterprise Metrics 1.3, our scalable, self-hosted Prometheus service
Blog post 5 min
Introducing the new Open Distro for Elasticsearch plugin for Grafana, also available in Amazon Managed Service for Grafana
Blog post 3 min
Want to visualize software development insights with Grafana? With our new Jira Enterprise plugin, you can!
Blog post 5 min
A closer look at the admin API and plugin for centralized tenant administration and control in Grafana Enterprise Logs
Blog post 4 min
The new Splunk Infrastructure Monitoring plugin brings the SaaS formerly known as SignalFx to your Grafana dashboards
Blog post 5 min
The Splunk plugin for Grafana now supports data links for jumping directly from logs to traces
Blog post 5 min
With the new AWS IoT SiteWise plugin, you can visualize and monitor your equipment data in Grafana dashboards
Blog post 2 min