Grafana is a very powerful visualization platform. 1
We can build nice representation of our data with graphs, goals, charts, tables and many more possibilities. 2
The first thing that Grafana needs is a connection to a database in Grafana. 3
It's called datasource. 4
There are already many predefined connections to these sources, and obviously in our situation we're 5
going to use the source called Influxdb. 6
From there, Grafana proposes a configuration web page where we can fill in all the information of our 7
database. 8
So let's do it. 9
We can provide a name for the data source. 10
Let's call it "influxdb", for the query language, 11
we're going to use "flux" because it's more powerful. 12
But anyway, the queries will be generated, so we won't have to bother much about that. 13
Then comes the database location. 14
So here we need to provide the URL where influxdb has been installed. 15
In my case I can provide my server name Iot-app.univ-lorawan.fr on port 8086. 16
Now for all the other information, everything has been filled in in the Docker compose configuration 17
file. 18
As often I used "admin" for the username and "univ-lorawan" for the password. 19
The organization is "training-usmb". 20
The token is this one, but you might have change it. 21
And the bucket is "iot-platform". 22
Once everything is done we can test the database connection. 23
So we click on the save and test button and it should return a green message saying that the datasource 24
is working. 25
Now we want to explore the database to create a graph with the temperature. 26
So we go on the explore section and there we can provide a script with the queries for the database. 27
So we'll provide a corresponding bucket where the data needs to be extracted, the measurement and the 28
field we want to plot. 29
But of course the script is a specific language and we are not going to learn this in this course. 30
And we actually don't need because if we come back to influxdb, in the Data Explorer section we left 31
a few minutes ago, then let's say that we selected a temperature for this device called device1-otaa. 32
Or in my case, then we just need to click on script editor and influxdb generates the query. 33
This is exactly this query that we need to provide to Grafana. 34
So I just copy it and I paste it in Grafana. 35
Now, if I auto update this page, then each time a new value is sent from one device, it's stored 36
in the database 37
thanks to Node-RED and it's displayed here thanks to Grafana. 38
So that's our temperature. 39
If we're happy with this chart, then we can add it to our dashboard by clicking on "Add to Dashboard." 40
I haven't created any dashboard yet, so I will add it in a new one. 41
And I can save it. 42
I call it lorawan sensors. 43
For the RSSI. 44
It's exactly the same story. 45
In Influxdb I go back in the query builder. 46
Select the query I want to create. 47
I select the RSSIvalue. 48
I can verify if it's what I expected. 49
Then I copy the query from the script editor. 50
Okay, now I go in Grafana explorer and I past the query. 51
Great. 52
And if it's fine, then we can add it to the existing dashboard. 53
There we go. 54
We are done. 55
Now you can explore Grafana and see which representations fits you the best. 56
We can quickly switch between visualization using the edit button. 57
And in the top right corner. 58
Change the option. 59
For example, you can use a gauge if you want to see only the last value. 60
There are hundreds of plugins and different settings that will make your dashboard very nice.