Visualize

To visualize real time or historical data, open source platform Grafana is used.

Install Grafana

If ogamma Visual Logger 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 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 or PostgreSQL.

Using SimpleJson data source.

  • Install SimpleJson data 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 SimpleJson type, and configure it to connect to the OPC UA Data Logger endpoint (http://localhost:3000/grafana):

    • From the left side menu bar, select icon Configuration;
    • Click on Data Sources;
    • Click on button Add data source;
    • From the list of data sources, select SimpleJson;

    • Configure settings:

      • In the field HTTP/URL enter URL of the ogamma Visual Logger:

        http://localhost:4880/grafana
        

        Note

        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.

Using PostgreSQL data source.

  • Open Data Sources page in Grafana, and click on button Add Data Sources.
  • Select PostgreSQL and edit connection settings as shown in the screenshot:

Setup dashboards.

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):

_images/GarafanaCreateDashboard.png

Reading values from SimpleJson data source

In this case requests to get data values sent to the ogamma Visual Logger 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:

_images/GrafanaPanelSettings-Json.png

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):

_images/GrafanaPanelSettings-PostgreSQL.png

Example of the SQL query can be found below:

SELECT
    $__time(time),
    value
  FROM
    values
  WHERE
    $__timeFilter(time) and sourceid='2'

Here time, value and 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 id).

_images/SourceIdInGui.png

Tip

For details on how to configure Grafana dahsboards and panels please refer to its documentation here

Typical Grafana dashboard is illustrated below: