Prepare Grafana to visualise IoT and RTLS data from Pareto Anywhere via a PostgreSQL database.
Learn how to install and prepare Grafana for IoT and RTLS applications with Pareto Anywhere.
A PostgreSQL database installed.
Install the dashboarding tool on a specific operating system.
Follow the instructions specific to your operating system to install Grafana:
Follow the official Install Grafana on Debian or Ubuntu tutorial.
Follow the official Install Grafana on Windows tutorial.
Follow the instructions specific to your operating system to run Grafana:
Open a terminal and start the grafana systemd service with the following command:
sudo systemctl start grafana-server
In the case where Grafana should run automatically each time the machine boots, run also the following command:
sudo systemctl enable grafana-server
Execute the bin/grafana-server.exe file provided by the installation.
In the case where Grafana should run automatically each time the machine boots, use NSSM, as recommended in the Grafana installation tutorial.
With Grafana running locally, browse to the login page at localhost:3000 and then:
The Welcome page should be displayed following a successful login. It is now possible to connect PostgreSQL as a data source, which is covered in Step 2 below.
Select and configure PostgreSQL as a data source.
From the Home screen of Grafana, do either of the following:
Then, from the list of data sources, scroll down to the PostgreSQL data source and click its icon:
This will open a PostgreSQL data source configuration page. Complete the configuration as described in Part 2 below.
From the PostgreSQL data source configuration page, complete the fields as specified in the tables below:
Name | grafana-postgresql-paretoanywhere |
---|---|
Default | true |
Host URL | localhost:5432 |
---|---|
Database name | pareto_anywhere |
Username | grafana |
---|---|
Password | paretoanywhere |
Version | 15* |
---|
*select the closest version to the installed PostgreSQL instance
All other configuration options may be left at the default values.
Click the Save & test button to complete the configuration. A Database Connection OK message should appear.
The PostgreSQL data source is successfully configured. It is now possible to build queries for visualisation, which is covered in Step 3 below.
Build a PostgreSQL query to visualise IoT and RTLS data.
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 with a Queries window, similar to that shown below.
In the Queries window, click the Code selector and paste in the following query:
SELECT $__timeGroupAlias(timestamp, 1m), COUNT(dynamb) FROM dynamb GROUP BY 1;
This query will count the number of dynamb entries per minute as a time series.
Click Run query to execute the query on the PostgreSQL database and visualise the result, which may resemble the following:
If the visualisation indicates No data and a warning icon appears at the top left of the panel, then an error has occurred. Hover over the icon to observe the error message.
Customise the visualisation by editing the panel options at right. Consult the following Grafana documentation pages for details:
After the panel is configured, click Save dashboard to save the visualisation and the dashboard in which it resides.
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.