Skip to content

johnjcool/db2-datasource

Repository files navigation

Grafana DB2 Data Source Backend Plugin

Build

It is based on the great work of https://github.com/jcnnrts/db-2-datasource

What is Grafana Data Source Backend Plugin?

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.

Getting started

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

Frontend

  1. Install dependencies

    yarn install
  2. Build plugin in development mode or run in watch mode

    yarn dev

    or

    yarn watch
  3. Build plugin in production mode

    yarn build

Backend

  1. 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
  1. 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
  1. 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"
  1. 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

Run all together

  1. 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
  1. Open the browser on http://localhost:3000

Learn more

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published