Grafana
A connection between Grafana and system:inmation can be established using Grafana’s SimpleJson plugin and an Advanced Endpoint of the system.
Installation of the Grafana 'simple-json plugin'
-
Download the SimpleJson Plugin .zip file from the Grafana website here:
https://grafana.com/api/plugins/grafana-simple-json-datasource/versions/1.4.2/download. -
Move the .zip file to the plugins folder of your Grafana installation folder. In a default installation this is located in C:\Program Files\GrafanaLabs\grafana\data\plugins.
-
Using Windows File Explorer navigate to Grafana’s bin folder. Its default location is C:\Program Files\GrafanaLabs\grafana\bin.
-
In the Windows File Explorer open the File menu and select
. -
In PowerShell run the following command:
PS> grafana-cli plugins install grafana-simple-json-datasource
-
Restart the Grafana Windows service by executing the following line in the Powershell:
PS> restart-service Grafana
Alternatively you can restart the Service in in Windows 'Services'.
Andvanced Endpoint Configuration
-
In DataStudio go to the Server Model Panel, and select the WebAPIServer object by left-clicking it.
-
In the Object Properties Panel of the WebAPIServer object, expand the Common section, and check the value of the Context Path property. This path describes the object where the WebAPIServer looks for the Lua script which provides the Advanced Endpoint.
In the default setting, this path points to the Script Library of the WebAPIServer object itself. -
Find the object which you identified in the previous step in the Model Panel, click on it and in the Properties Panel expand the Script Library section.
-
In the Script Library section, click the + icon to add a new module to the library and enter 'grafana-simple-json' as the Module Name.
-
In the Lua Script Body line click on the … icon to open the Script Editor.
-
Copy the script from grafana-simple-json.lua into the Script Editor, then click OK to add the script to the Script Library and close the editor.
Grafana Configuration
-
In your web browser, open Grafana by entering '<GrafanaHostNameOrIP>:<GrafanaPort>' (e.g. 'localhost:3000') into the address bar.
-
In the left hand sidebar click on the gear icon to open Grafana’s configuration. 'SimpleJson' should be listed in the Data sources section. If you have many data sources configured, the search bar may be helfpul. If 'SimpleJson' is not listed in the Data sources, double check in the Plugins section, if the installation of the plugin was successful.
-
In the Data sources section, click on the SimpleJson data source to open the settings for this data source.
-
In the HTTP section, for the URL property enter the address of the advanced endpoint: http://localhost:8002/api/v2/execfunction/grafana-simple-json or http://<WebAPIHostNameOrIp>:<port>/api/v2/execfunction/grafana-simple-json (depending on your hostname and port configuration).
-
In the Auth section, select a suitable option and provide the corresponding credentials. E.g. for the Basic auth option, in the Basic Auth Details subsection, enter your user name and password.
-
Click Save & Test. In the top right hand corner, for a brief moment a green message box is displayed, informing you that the data source has been updated. Don’t be disturbed if a warning 'HTTP error Not found' is displayed. It normally does not affect the connection to the Advanced Endpoint.
Adding data sources to Grafana
-
In Grafana, click the + icon in the left sidebar and, in the opening Add panel dialog, click 'Add and empty Panel' .
-
In the 'New dashboard / Edit Panel' page, go to the Data source dropdown list and select 'SimpleJson'.
-
Find the 'select metric' dropdown list (next to 'timeserie') and select the desired object from this list. Alternatively, you can right-click the object (which you want to display in Grafana) in DataStudio, and select 'Copy full path' from the context menu. Then paste the path into the 'select metric' input field in Grafana.
For the data to be displayed, the system:inmation object must have the Raw History option enabled in Archive Options > Value Storage Strategy in DataStudio’s Properties Panel. |
More information about Grafana plugins can be found on http://docs.grafana.org/plugins/installation/. |