It is based on the great work of https://github.com/jcnnrts/db-2-datasource
Grafana supports a wide range of data sources, including Prometheus, MySQL, and even Datadog. There’s a good chance you can already visualize metrics from the systems you have set up. In some cases, though, you already have an in-house metrics solution that you’d like to add to your Grafana dashboards. Grafana Data Source Plugins enables integrating such solutions with Grafana.
For more information about backend plugins, refer to the documentation on Backend plugins.
A data source backend plugin consists of both frontend and backend components.
-
Install dependencies
yarn install
-
Build plugin in development mode or run in watch mode
yarn dev
or
yarn watch
-
Build plugin in production mode
yarn build
- Preparing docker container to build the backend on Linux:
docker run -it -v $(pwd):/app -w /app golang:1.13 /bin/bash
apt-get update
apt-get install wget libxml2 libstdc++6
- Update Grafana plugin SDK for Go dependency to the latest minor version:
go get -u github.com/grafana/grafana-plugin-sdk-go
go mod tidy
- Install DB2 clidriver:
cd $GOPATH/pkg/mod/github.com/ibmdb/[email protected]/installer
go run setup.go
export CGO_CFLAGS="-I$GOPATH/pkg/mod/github.com/ibmdb/clidriver/include"
export CGO_LDFLAGS="-L$GOPATH/pkg/mod/github.com/ibmdb/clidriver/lib"
export LD_LIBRARY_PATH="$GOPATH/pkg/mod/github.com/ibmdb/clidriver/lib"
- Build backend plugin binaries for Linux (we couldn't use mage becaus we couldn't build static):
cd /app
go build -o dist/gpx_db2_linux_amd64 ./pkg
- Build and run docker image:
docker build -t johnjcool/grafana:8.3.2 .
docker run -p 3000:3000 -v "$(pwd)/dev/grafana.ini":/etc/grafana/grafana.ini -v "$(pwd)"/dist:/var/lib/grafana/plugins/johnjcool-db2-datasource johnjcool/grafana:8.3.2
- Open the browser on http://localhost:3000
- Build a data source backend plugin tutorial
- Grafana documentation
- Grafana Tutorials - Grafana Tutorials are step-by-step guides that help you make the most of Grafana
- Grafana UI Library - UI components to help you build interfaces using Grafana Design System
- Grafana plugin SDK for Go