/AccessTSN_Industrial_Use_Case_Demo_Webview

AccessTSN Industrial Use Case Demo - Webview: This component sets up grafana with an influxdb and writes drive control data from a shared memory to influxdb. This is used for Best-Effort traffic.

Primary LanguageC++MIT LicenseMIT

AccessTSN Industrial Use Case Demo - Webview

This is a demonstration to give an example on how to use Linux with the current support for Time Sensitive Networking (TSN) as an industrial endpoint. For this purpose the components of this demonstration form a converged network use case in an industrial setting.

The Use Case Demonstration is aimed at the AccessTSN Endpoint Image and tested with it but should also work independently from the image.

This work is a result of the AccessTSN-Project. More information on the project as well as contact information are on the project's webpage: https://accesstsn.com

The Industrial Use Case Demo - Webview Git-project

The AccessTSN Industrial Use Case Demo consists of multiple Git-projects, each holding the code to one component of the demonstration. This is the Webview project. This repository contains an database connector to write data of a shared memory (defined in mk_shminterface.h) into InfluxDB. It also contains a connection to a Grafana installation and a dashboard to visualize the data written into InfluxDB. You can easily get a working stack by using the provided installscript.sh shell script. But you still need to write the data into the shared memory yourself. This can be done with the other components of the AccessTSN Industrial Use Case demo.

The main repository for AccessTSN Industrial Use Case Demo can be found on Github: https://github.com/iswunistuttgart/AccessTSN_Industrial_Use_Case_Demo

Documentation

What to expect

Using the shell script for installation will add a repo and install a stable version of InfluxDB 1.8.3. Be aware that no user or password protection is included. InfluxDB should start at boot. If not, please refer to the official documentation of InfluxDB at InfluxDB 1.8 documentation. The script will also add a repo to Grafana and install it. After the installations are complete the files in the subdirectory provisioning will be copied into the respective folder of the Grafana installation. After that Grafana will be configured to start at boot. Grafana will also be started after the installation. Keep in mind that this repository does not contain code to write any data into the defined shared memory of mk_shminterface.h. You either need to develop your own code or get an example code. Running the interface will create a database called tsn_demo in InfluxDB. If it already exists all new data will be appended.

Installation

  1. Get the repository and all submodules with:
    git clone --recurse-submodules <INSERT_REPO>
  2. Use the bashscript from within the repository:
    sudo ./installscript.sh This will first check for dependencies and then install, setup and start InfluxDB and Grafana. Then it will build the database connector for the Industrial Use Case Demo write2influxdb.

Manual building of the database connector

Switch to the folder src and compile write2influxdb.cpp.
cd src/
make write2influxdb

Running the database connector

The database connector is used to write data from the SHM Interface to Influxdb. After building the database connector can be found in the src subdirectory. Run the compiled code with -h flag to see the switches for used variables:
sudo ./write2influxdb -h
or for use of all variables:
sudo ./write2influxdb -aio

Use Grafana and verify the installation

Use your favorite web browser and navigate to localhost:3000 You will be prompted to sign into Grafana. Since it is the standard installation the user is admin same as the password is admin To be sure everything went as expected check the configuration menu by clicking the gear symbol on the left. You should see a single data source called ISW_TSN_DEMO. Open the configuration by clicking on it and scroll down to the bottom, hit the test button and you should see a green field saying Data source is working. After verify the data source switch to Dashboards -> Manage and select TSN_Demo. If data is written to the SHM now you will see the data in the dashboard.

Tested Version

The initial released version is tested with

  • Debian GNU/Linux 10 (buster)
  • InfluxDB version 1.6.4
  • InfluxDB version 1.8.3
  • Grafana v7.2.2 (ad9d408ac2)

Nice to know

The dashboard is not working correctly with Grafana version 7.0.2 Sometimes the time is not shown correctly in the dashboard. If you encounter this you might want to set a timezone in Grafana. If you want to access InfluxDB version 1.6.4 from the command line you need to install influxdb-client The Data source and dashboard is loaded from provisioning files located at /etc/grafana/provisioning If you make changes to the dashboard you need to save it as a new dashboard or change the .json file in the provisioning subdirectory dashboards If you have no application to write into the SHM you might get an access error. In test cases you needed to give sudo permission to the writer and reader of the SHM otherwise the applications were not working properly.