📢 Notice: This sample has been Archived. Dependencies will not be updated and pipelines will not be run. Please contact samples@osisoft.com or visit The OSIsoft Feedback Site for comments |
---|
Version: ARCHIVED
This sample demonstrates how to build a Grafana plugin that runs queries against the Sequential Data Store of AVEVA Data Hub or Edge Data Store. The sample performs normal "Get Values" calls against a specified stream in SDS, using the time range of the Grafana dashboard. See the Grafana Documentation for more information on developing Grafana plugins.
- Grafana 7.0+
- Web Browser with JavaScript enabled
- NodeJS
- Git
- If using AVEVA Data Hub, register a Client Credentials Client in AVEVA Data Hub; a client secret will need to be provided to the sample plugin configuration
- If using Edge Data Store, the browser must be running local to a running copy of Edge Data Store
- Copy this folder to your Grafana server's plugins directory, like
.../grafana/data/plugins
- (Optional) If using other plugins, rename the folder to
aveva-data-hub-sample
- Open a command prompt inside that folder
- Install dependencies, using
npm ci
- Build the plugin, using
npm run build
(ornpm run dev
for browser debugging) - Restart the Grafana server to load the new plugin
- Open the Grafana configuration and set the parameter
allow_loading_unsigned_plugins
equal toaveva-sds-sample
or to the name of the folder set in step 2 (see Grafana docs) - Add a new Grafana datasource using the sample (see Grafana docs)
- Choose whether to query against AVEVA Data Hub or Edge Data Store
- Enter the relevant required information; if using ADH, the client secret will be encrypted in the Grafana server and HTTP requests to ADH will be made by a server-side proxy, as described in the Grafana docs
- Open a new or existing Grafana dashboard, and choose the Sequential Data Store Sample as the data source
- Enter your Namespace (if querying ADH) and Stream, and data will populate into the dashboard from the stream for the dashboard's time range
- Open a command prompt inside this folder
- Build the container using
docker build -t grafana-adh .
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, theallow_loading_unsigned_plugins
option is being overridden to allow the unsigned plugin in this sample to be used. - Run the container using
docker run -d --name=grafana -p 3000:3000 grafana-adh
- Navigate to localhost:3000 to configure data sources and view data
A limitation of this sample is that the use of a Client Credentials Client means that anyone using the Data Source in Grafana receives the same access inside AVEVA Data Hub. Grafana supports generic OAuth login to the Grafana server, and can forward its token to the destination data source, including ADH. See here for more information on this feature of Grafana. This feature could be used to ensure individual users must log in to receive the appropriate permissions in ADH.
However, Grafana's implementation of the Authorization Code Flow does not use Proof of Key Code Exchange, or PKCE, which is an additional security layer required by ADH Authorization Code Clients. Grafana also does not support ADH Hybrid Clients as it does not support a POST
back from the authentication server, nor does it support the response_type
and response_mode
headers required by that flow.
If you are interested in using using ADH OAuth in your Grafana server, please check and comment on this issue in the Grafana GitHub repository.
- Add a new Grafana datasource using the sample (see Grafana docs)
- Choose AVEVA Data Hub
- Toggle the "Community Data" switch to 'true'
- Enter the relevant required information. You can find the Community ID in the URL of the Community Details page.
- Open a command prompt inside this folder
- Install dependencies, using
npm ci
- Run the tests, using
npm test
For the main ADH page ReadMe
For the main samples page ReadMe