/scylla-grafana-datasource

A grafana backend plugin for ScyllaDB

Primary LanguageTypeScriptApache License 2.0Apache-2.0

Scylla/Apache Cassandra Backend Plugin

The plugin is currently in Alpha and not ready for comercial usage.

CircleCI

This plugin allows connecting Scylla or Appahe Cassandra to Grafana.

What is Scylla Grafana Data Source Backend Plugin?

A Backend plugins is a type of data-source plugin that runs on the server. That means that that from IP connectivity, your Database (Scylla or Appache Cassanra) should be accessible from the grafana server.

Getting started

Use Grafana 7.0 or higher

  • Download and place the datasouce in grafana/plugins directory.

This plugin is not signed yet, Granfa will not allow loading it by default. you should enable it by adding:

for example, if you are using Grafana with containers, add:

-e "GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=scylladb-scylla-datasource"

You can now add the scylla data source, the only current configuration is a host in the cluster.

When adding a panel use CQL to get the data. you can only do select statements, but any valid select would work.

For Scylla-Monitoring Users

  • Take the master branch that would run Grafana 7
  • Either edit and add the the ALLOW_PLUGINS to start-grafana.sh or use the command line flag to start-all.sh
./start-all.sh -s scylla_servers.yml -c "GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=scylladb-scylla-datasource"

Configure the datasoure from file

  • If you do not want to configure the data source on every restart, edit grafana/datasource.yml And add:
- name: scylla-datasource
  type: scylladb-scylla-datasource
  orgId: 1
  isDefault:
  jsonData:
    host: 'node-ip'

Replacing node-ip with an ip of a node in the cluster.

To support user and password add secureJsonData to grafana/datasource.yml

- name: scylla-datasource
  type: scylladb-scylla-datasource
  orgId: 1
  isDefault:
  jsonData:
    host: 'node-ip'
  secureJsonData:
    user: 'cassandra'
    password: 'cassandra'

Configure the Datasource using Grafana API:

Grafana API allows adding datasource. The following will add a data source without a username and password, replace the ADMIN_PASSWORD with Grafana's Admin password

curl -XPOST -i http://admin:$ADMIN_PASSWORD@localhost:3000/api/datasources \
     --data-binary '{"name": "scylla-datasource","type": "scylladb-scylla-datasource", \
     "orgId": 1,"access":"proxy", "jsonData":{"host": ""}}' -H "Content-Type: application/json"

The following example shows how to configure the plugin with username and password

curl -XPOST -i http://admin:$ADMIN_PASSWORD@localhost:3000/api/datasources \
     --data-binary '{"name": "scylla-datasource","type": "scylladb-scylla-datasource", "orgId": 1,"access":"proxy", \
     "jsonData":{"host": ""}, "secureJsonData":{"user": "scylla", "password": "scylla"}}' \
      -H "Content-Type: application/json"

Compiling the data source by yourself

A data source backend plugin consists of both frontend and backend components.

Frontend

  1. Install dependencies
yarn install
  1. Build plugin in development mode or run in watch mode
yarn dev

or

yarn watch
  1. Build plugin in production mode
yarn build

Backend

  1. Update Grafana plugin SDK for Go dependency to the latest minor version:
go get -u github.com/grafana/grafana-plugin-sdk-go
  1. Build backend plugin binaries for Linux, Windows and Darwin:
mage -v
  1. List all available Mage targets for additional commands:
mage -l

Learn more