Create Grafana time series visualisations of stored IoT data from Pareto Anywhere.
Learn how to create time series visualisations in Grafana with IoT data from Pareto Anywhere.
A PostgreSQL database and Grafana installed.
Create a new time series visualisation with PostgreSQL query.
In Grafana, open an existing dashboard, or create a new dashboard.
From the top menu of the dashboard, click Add and select Visualization.
An Edit panel screen will appear, similar to that shown below.
From the Visualization pull down menu at right, select Time series.
Grafana offers the possibility to prepare a query via a Builder tool or a Code entry option. In the Queries window, select the Code entry option.
In the code window, enter a PostgreSQL query based on one of the following examples:
Minimum, average and maximum temperature (3 series) across all devices per 15-minute time window.
SELECT $__timeGroupAlias(timestamp, 15m), min((dynamb->>'temperature')::float) AS min, avg((dynamb->>'temperature')::float) AS avg, max((dynamb->>'temperature')::float) AS max FROM dynamb WHERE dynamb ? 'temperature' GROUP BY 1 ORDER BY $__timeGroup(timestamp, 15m);
Each individual device's battery percentage (variable number of series) per 1-hour time window with device signature (id) as label.
SELECT $__timeGroupAlias(timestamp, 1h), avg((dynamb->>'batteryPercentage')::float) AS avg, devicesignature FROM dynamb WHERE dynamb ? 'batteryPercentage' GROUP BY 1, devicesignature ORDER BY $__timeGroup(timestamp, 1h);
Click the Run query button to validate that the query is successful. Correct any errors and repeat as necessary.
In the case of queries with a variable number of series, a Multi-frame time series tranformation will separate each series for proper visualisation. In the Transformations window, click the Add transformation button.
Select the Prepare time series transformation from the list of transformations.
Select the Multi-frame time series transformation from the list of formats.
The query should now be visualised correctly. It is now possible to customise the panel, which is covered in Step 2 below.
Customise the visualisation and the panel.
Details to come.
Tutorial prepared with ♥ by jeffyactive.
You can reelyActive's open source efforts directly by contributing code & docs, collectively by sharing across your network, and commercially through our packages.Continue exploring our open architecture and all its applications.