Skip to content
Aleks Volochnev edited this page Feb 20, 2022 · 15 revisions

If you want to try the datasource, please follow the easy steps of this quick demo:

Prerequisites

  • docker
  • docker-compose

Instructions

1. Download the repository using git clone (simple archive download will work too)

git clone https://github.com/HadesArchitect/GrafanaCassandraDatasource.git 
cd GrafanaCassandraDatasource/demo

IMPORTANT Switch to the GrafanaCassandraDatasource/demo folder as in the instruction above (notice demo subfolder)

2. Launch the project

docker-compose up -d

3. Wait for Cassandra to start, it may take a bit

Check the status with the command docker-compose exec cassandra nodetool status | grep rack1. As soon as the output looks like UN 172.23.0.3 88.16 KiB ... (UN means UP and NORMAL), you are good to go

4. Add the datasource

Open the link http://localhost:3000/datasources/new in the new tab, login using user admin password admin and select the Apache Cassandra datasource. In the new window, specify following details: host is cassandra:9042, others empty.

Save and test!

5. Add the panel

Follow the link http://localhost:3000/dashboard/new and push the Add new panel button.

7. Add the first query using Query Configurator, the simplest way to query data

  • Keyspace test
  • Table test
  • Time Column registered_at
  • Value Column temperature
  • ID Column sensor_id
  • ID Value 99051fe9-6a9c-46c2-b949-38ef78858dd0

8. Add the second query using Query Editor, the more powerful way to query data with direct access to CQL

First, press the + Query button

Then, switch the new query to the query editor mode pushing the toggle text edit mode button.

In the Raq CQL field, specify the query:

SELECT sensor_id, CAST(temperature as double), registered_at FROM test.test WHERE id IN (99051fe9-6a9c-46c2-b949-38ef78858dd0, 99051fe9-6a9c-46c2-b949-38ef78858dd1) AND created_at > $__timeFrom and created_at < $__timeTo

That's it, you made it!

9. Don't forget to clean up

Remove the running containers as soon as you don't need them

docker-compose kill
docker-compose down
Clone this wiki locally