Couchbase-Ecosystem / grafana-plugin

Grafana Couchbase datasource plugin
MIT License
12 stars 3 forks source link
hacktorfest

Couchbase datasource plugin for Grafana

"Couchbase-powered dashboard"

This is a simple community-supported Grafana datasource plugin that allows querying time series and log data from Couchbase Clusters, inclding Capella clusters.

Installation from sources

This plugin uses Standard Grafana DataSource Backend Plugin build process. Also, the ./run.sh script in this repository is used to launch Grafana with the plugin in a Docker container and usually contains the latest build process commands.

Usage

The datasource supports only SELECT statements. The datasource plugin provides two additional sql++ WHERE clause functions that inject into all submitted queries time range filtering clauses according to selected in Grafana UI report time range:

Both functions take the name of the field to be used for filtering. One and only one of these functions must be included in every query submitted through the plugin: Examples:

select count, time_string from test where str_time_range(time_string)
select count, timestamp from test where time_range(timestamp)

These are pseudo-functions, references to them are replaced with a set of WHERE filters on provided field by the plugin before the query is sent to the cluster.

Development instructions

Add datasources/couchbase.yaml with your datasource configuration:

apiVersion: 1
datasources:
- name: Couchbase
  type: couchbase-datasource
  access: proxy
  jsonData:
    host: <...>
    username: <...>
  secureJsonData:
    password: <...>

Use ./run.sh to start grafana in docker container with following mounts:

    volumes:
    - ./couchbase:/var/lib/grafana/plugins/couchbase
    - ./datasources:/etc/grafana/provisioning/datasources

Open grafana at http://localhost:3000, use admin as both login and password. You don't need to setup a new password after you login despite grafana asking you to do that -- just reload the page.