InfluxDB 2.0 built-in visualization tools.¶
If InfluxDB version 2.0 is used as TSDB, to visualize data stored in the TSDB you can use its built-in visualization tools. For details, refer to InfluxDB documentation at https://v2.docs.influxdata.com/v2.0/visualize-data/.
Visualization with Grafana.¶
The open source platform Grafana can be used to visualize data in 2 different ways:
- without accessing TSDB, with SimpleJson data source plugin via ogamma Visual Logger for OPC REST API endpoint (real time data - always, and historical data - in case if OPC UA Server supports historical data);
- accessing data already stored in the TSDB by ogamma Visual Logger for OPC, with PostgreSQL/TimescaleDB or InfluxDB plugin.
Next sections describe how to install and use Grafana.
If ogamma Visual Logger for OPC is installed using Docker cofiguration file as described in section Getting Started and runs in Docker container, then Grafana is already installed, running and accessible on endpoint URL http://localhost:3000.
If ogamma Visual Logger for OPC is deployed manually using distribution package, then Grafana needs to be installed manually following instructions from Grafana web site.
Instructions on Grafana web page suggest to use
wget tool to download the installer. If you don’t have wget tool installed, then you can download it from here: https://eternallybored.org/misc/wget/. For your convenience it is also included into distribution package for Windows.
Setup Grafana data source.¶
Data from OPC UA Servers can be visualized in Grafana using 2 types of data sources:
SimpleJson data source.¶
SimpleJsondata source plugin (instructions are available at https://grafana.com/plugins/grafana-simple-json-datasource/installation).
In Docker setup, this data source plugin will be already installed.
Add data source of
SimpleJsontype, and configure it to connect to the Grafana endpoint of the ogamma Visual Logger for OPC (http://localhost:3000/grafana):
- From the left side menu bar, select icon
- Click on
- Click on button
Add data source;
From the list of data sources, select
In the field HTTP/URL enter URL of the ogamma Visual Logger for OPC. If ogamma Visual Logger and Grafana are installed in the same machine,
localhostcan be used as host name:
If both ogamma Visual Logger for OPC and Grafana are running within Docker container, using file docker-compose.yml from GitHub project
https://github.com/onewayautomation/ogamma-logger, and field
accessis set to
server, then host name should be set to
Adjust host name according to your setup.
Click on button
Save and Test. If settings are correct, message should appear saying that data source is working.
- From the left side menu bar, select icon
PostgreSQL data source.¶
Applicable only when time-series database type is
Data Sourcespage in Grafana, and click on button
Add Data Sources.
PostgreSQLand edit connection settings as shown in the screenshot:
Create new dashboard.¶
To create new dashboard, from the left side menu bar click on icon with plus sign, select
Dashboard, abd click on button
Add Query (it suggests to add new panel into new dashboard right away):
Reading values from SimpleJson data source¶
In this case requests to get data values sent to the ogamma Visual Logger for OPC through its REST endpoint by Grafana’s SimpleJson plugin. Then, depending on settings in columns
Get History From and
Read Type, data values are read by ogamma Visual Logger either from TSDB, or from OPC UA Server by calling Read or HistoryRead request.
Configure settings in the new panel selecting
SimpleJson as data source:
Reading values stored in PostgreSQL database.¶
It is possible also to read already logged data values from PostgreSQL database, using PostgreSQL data source plugin for Grafana (installation is not required, included into Grafana by default):
Example of the SQL query can be found below:
SELECT $__time(time), value FROM values WHERE $__timeFilter(time) and sourceid='2'
sourceid are column names in the
values table. You can figure out corresponding to the OPC UA variable
sourceid from Logged Variables data grid on the configuration GUI (column
For details on how to configure Grafana dahsboards and panels please refer to its documentation here
Typical Grafana dashboard is illustrated below: