Grafana Dashboards
If you click on this menu item, the external Grafana tool will open in a new window, where you can create various dashboard visualizations of your device data and digital twin data points as well as alarms. With the appropriate user rights, you can apply the different functions. Here you can find a detailed manual on how to use Grafana: https://grafana.com/docs/
Viewing device data from the IoT Data Hub
The prerequisite for using the Grafana tool is to enable “Reporting” and “Dashboard Instance” under the “Modules” menu (Settings > Permissions > Modules). Note that each of the devices you use for data visualization must have a stored device type. In addition, the assignment of the types to the target variables under the “Type definition” field in the respective parser of the device type is necessary to index measured values in InfluxDB and visualize them with Grafana.
Select the ‘Reporting “{account name}"’ data source in the query before creating the dashboard:
Display data states from Digital Twins
You also have the option to visualize data states from the digital twin in Grafana. Prerequisite for this function is the activation of the “States InfluxDB Datasource” under Settings > Permissions > Modules > Integrations.
In addition to the automated option mentioned above, there is also the manual option to create the data source in Grafana. For this, you first create a new API key (Settings > Accounts > API Key) to which you assign the role “InfluxDBReader” for the desired access area (account). This role allows access to the influx data of the account to which this permission has been explicitly assigned in an API key, without inheritance or access to the sub-accounts.
In the Dashboard Builder, you then perform the following steps to create another Influx data source alongside the existing ‘Reporting “{account name}"’ data source, which is only responsible for displaying data from the IoT Data Hub:
-
Add a new InfluxDB data source.
-
Give the new data source a title.
-
Enter the following URL under HTTP: https://xapi.niota.io/xapi/v1/influxdb
-
Add a new header with “x-api-key” and the previously created API key as a value in the “Value” field on the right.
-
Set the HTTP method with “POST” and click on “Save & Test”.
This is how you then generate a database query to create a dashboard for data points from the Digital Twin:
-
Before creating the dashboard, select the newly created data source in the query, for example:
-
First select “states_history” under “select measurement”.
-
Under “select” select “field(value_number)” (instead of “field(value)").
-
Now select the tags that refer to the data point(s) you want to visualize.
-
Under “group by” replace the “fill(null)” with “fill(none)". The result is a graph with the data points.
Info: There is a limit of max. 5000 data points to be visualized in Grafana, if you are using an asterisk ("*") in your query
Explanation of the available tags
The following tags are available in Grafana for filtering the data:
account_id: Id of the account for which the data point was created.
config_id: Id of the connector from which the information for this data point originates.
state_id: Id of the datapoint.
dtwin_id: Id of the digital twin or virtual device.
dtwin_title: Title of the digital twin or virtual device.
twin_category: Differentiation whether it is a virtualDevice or digitalTwin.
twin_tags: Tag(s) of the digital twin or virtual device.
state_identifier: Key of the data point.
state_type: type of the datapoint (number/string/boolean/json).
parser_variable: Assigned variable in the parser representing this datapoint.
source_identifier: The external ID of the virtual device for which this datapoint was created.
source_type: Source/system from which the data point originates (e.g. connector or aggregation).
twin_ancestor_ids: Id's of the parent twins in the hierarchy.
unit: Unit of the value as stored in the datapoint.