Setup Loraserver [5] – Display data on Grafana with HTTP Integration

Setup Loraserver [5] – Display data on Grafana with HTTP Integration


Hello everybody in this video I will show you how to get the data and display To the Grafana Server from HTTP integration And to get the data via HTTP integration I will use the XAMPP on Ubuntu The reason why I don’t use the XAMPP on Windows And use Ubuntu to Transfer data from Loraserver to Windows Because when I create a MySQL in Grafana It cannot connect to the global IP So I have to download the XAMPP on Ubuntu And hold the Webserver and MYSQL on the Ubuntu First of all we have to download the XAMPP But i have already downloaded into my
Ubuntu so if you want to download just Search the download XAMPP and download this packet After you unpackage or extract it you have to move to “opt” You will put your file code in htdocs folder But i have to start Apache Server and MySQL first You can use this to open the manager with user interface or you use command Right here you will start the MySQL and
start Apache Server Pay attention about this In my config I change the port from 80 To 1234 to different from the other port okay Just turn it off And now we will move to “htdocs” to test Create a new file to test I will create a php code Ok, As you see , the “hello.php” file right here I will run it to test the Apache Server Okay, your server is running correctly Now i will access to database via “localhost:1234/phpmyadmin” Okay if you can access this site your server is run correctly I will create a new one with “loraserverdatabase” This is the language, you can choose your language But I will use the “UTF-8 Vietnamese” I will create a table with name is “loratable” And column, i just create 3 columns First of all is “id” the second one is “value” and the last one is “time” Set is auto-increment with primary key Right here I will put the “value” I also put it is float because sometime my value is float or double Set it 10 length and the last one is “time ” You have to PAY ATTENTION about this The Grafana need a column “time” If you don’t create a column “time” Your Grafana cannot display your data And this type must have “timestamp”
okay pay attention about this Now i will access to the database via HTTP integration To know how to access the HTTP And explain about integration HTTP You have to watch the previous video I don’t explain more in this video Okay right here, this is my IP Ubuntu, Port and the file I will put Some code to get the data And in this code I will get the data, encode and save to database I have already written some. So I just copy and paste right here I will explain a little bit right
here First of all is the procedure to get The data and decoded like the previous
video And this is the new code The database we created is “loraserverdatabase” This is some procedures to check the connection And this is the “$insert” After i’d got the data from Loraserver I will insert it into “loratable” With the value is decoded And then query to insert, and close the connection I will put this code below this video The Loraserver send some value to this database Okay now you can save your data into the MySQL database So now I will download the Grafana and display into the chart First, I have to start it And the enable the Grafana Service Okay, Now i will check the status Okay it’s running correctly To check if it is running correctly We’ll move to “localhost:3000” Okay when you can access this site Your Grafana Server is run correctly Now we will create my first data source My database is MYSQL so I will create my SQL This is “localhost” that’s the reason why
I cannot hold the database on Windows The database name is “loraserverdatabase” You can put any number I will put as recommend Okay when you see database connection OK Your database can connect with the Grafana Create a new dashboard Right here I will choose the “mysqlloraserver” There are some query here because those are my old DB Don’t worry about that I will make the influxDB with Grafana in the next video Right here I will choose the “mysqlloraserver” Click it and re-write some code The value is appear right here and you
will find that by double-click in this This is your value the value as the MYSQL database But PAY ATTENTION Do you see this time? This is the wrong time with my Ubuntu clock Because this is th UTC time but you need to change it to Local time So we have to change a little bit in this code We have to change “time” to “UNIX_TIMESTAMP(time) as time_sec” Unix Timestamp transfer a parameter column right here as time sec from “loratable” Okay, Let’s check again Okay now double-click to find your value Now is 4:55 PM. Okay and right here around
4:00 to 5:00 PM. With this, you can display your data to check This is 16:53:41 with the value=1 Right here for 16:53:41 with
the value 1 Now save the dashboard Okay, and your dashboard will display right here You can move to main page If you want to access the chart Just click here If you want to change it to Bar chart or something you just move here “Visualization” Okay you can many effect right here Okay, you can change to Bar, Table ,… Okay that’s all of things you can do
with the Grafana and HTTP integration Well, but right here Do you see? it doesn’t real-time You have to update when click on the dashboard Okay you have to click on the dashboard to update it I don’t know why but if you know how to make the chart in in real time Just comment below this video It’s 2, but now i will click Double click and it will change It’s not change because all the value is “2” now Okay the new value is “3” But you see, the value right here just “2” But when i click on it It will change. But if I don’t click it it doesn’t change Okay, If you know how to make it in realtime. Just comment below this video Okay in the next video I will show how
to use the Grafana Server with influxDB Thanks for listening and watching!

Leave a Reply

Your email address will not be published. Required fields are marked *