Skip to content

AVEVA/sample-eds-grafana_plugin-datasource

Repository files navigation

Edge Data Store Grafana Data Source Plugin Sample

Version: 1.0.0

Build Status

This sample demonstrates how to build a Grafana data source plugin that runs queries against the Sequential Data Store (SDS) of the Edge Data Store (EDS). The sample performs normal "Get Values" calls against a specified stream in SDS, using the time range of the Grafana dashboard.

Requirements

Getting Started

If you plan to run this sample plugin on an existing Grafana server, the recommended sections are:

  1. Building and Deploying the Sample Plugin on a Grafana Server
  2. Configuring the Sample Plugin in Grafana

If you wish to deploy the sample plugin with a docker container also containing Grafana, then the recommended sections are:

  1. Deploying the Sample Plugin with Docker
  2. Configuring the Sample Plugin in Grafana

If you are a developer that wants to customize the plugin or add functionality to it, then the recommend sections are:

  1. Developing the Sample with Docker
  2. Configuring the Sample Plugin in Grafana

Building and Deploying the Sample Plugin on a Grafana Server

  1. Copy this folder to your Grafana server's plugins directory, like .../grafana/data/plugins
  2. (Optional) If using other plugins, rename the folder to aveva-eds-datasource
  3. Open a command prompt inside that folder
  4. Install dependencies, using npm install
  5. Build the plugin, using npm run build (or npm run dev for browser debugging)
  6. Open the Grafana configuration and set the parameter allow_loading_unsigned_plugins equal to aveva-eds-datasource or to the name of the folder set in step 2 (see Grafana docs)
  7. Restart the Grafana server to load the new plugin

Deploying the Sample Plugin with Docker

  1. Open a command prompt inside this folder
  2. Build the container using docker build -t grafana-eds .
    Note: The dockerfile being built contains an ENV statement that creates an environment variable that overrides an option in the grafana config. In this case, the allow_loading_unsigned_plugins option is being overridden to allow the unsigned plugin in this sample to be used.
  3. Run the container using docker run -d --name=grafana-eds -p 3000:3000 grafana-eds
  4. Navigate to localhost:3000 to configure data sources and view data

Configuring the Sample Plugin in Grafana

  1. Add a new Grafana datasource using the sample (see Grafana docs)
  2. Enter the port that EDS is running on
  3. Open a new or existing Grafana dashboard, and choose the AVEVA Edge Data Store (SAMPLE) as the data source
  4. Enter your Stream, and data will populate into the dashboard from the stream for the dashboard's time range

Developing the Sample with Docker

  1. Open a command prompt inside this folder
  2. Install dependencies, using npm install
  3. Build the plugin for development, using npm run dev
  4. In a new terminal window, update Grafana plugin SDK for Go dependency to the latest minor version, using go get -u github.com/grafana/grafana-plugin-sdk-go and go mod tidy
  5. Build backend plugin binaries for Linux mage -v build:Linux
  6. Start grafana by running docker-compose up --build
  7. Open Grafana, by default http://localhost:3000/

Running the Automated Tests on Frontend Components

  1. Open a command prompt inside this folder
  2. Install dependencies, using npm install
  3. Run the tests, using npm run test

Running the Automated Tests on Backend Components

  1. Open a command prompt inside this folder
  2. Install dependencies, using go mod tidy
  3. Run the tests, using go test

For the main ADH page ReadMe
For the main samples page ReadMe

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published