User Tools

Site Tools


latinet:unicaes:workshops:nig

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
latinet:unicaes:workshops:nig [2023/09/01 02:06] jan.sonntaglatinet:unicaes:workshops:nig [2024/09/13 19:11] (current) – [3. InfluxDB] harley.lara
Line 13: Line 13:
   - If you are on Linux, you can forward to step 2. If you are on Windows we recommend installing the Windows-Subsystem-for-Linux (WSL) with Ubuntu as the distribution.    - If you are on Linux, you can forward to step 2. If you are on Windows we recommend installing the Windows-Subsystem-for-Linux (WSL) with Ubuntu as the distribution. 
   - Now that we are in our Linux (testing done in Ubuntu) environment, we can install docker. You can follow the steps on the official website: [[https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository|Install Docker Ubuntu]]. If you are on WSL, every time you start the system you need to restart docker with: ''sudo service docker start''   - Now that we are in our Linux (testing done in Ubuntu) environment, we can install docker. You can follow the steps on the official website: [[https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository|Install Docker Ubuntu]]. If you are on WSL, every time you start the system you need to restart docker with: ''sudo service docker start''
-  - Download NIG docker files here: {{ :latinet:unicaes:workshops:local-nig.zip |Download local NIG files}} +    * For windows user: [[https://docs.docker.com/desktop/install/windows-install/|Install Docker Desktop on Windows]]  
-  - Unpack the files into an empty folder +  - Download NIG docker files here: ''git clone https://github.com/EOLab-HSRW/intro-to-iot.git'' 
-  - Open your WSL instance/Terminal and navigate to that folder. If you are using WSL you can find all the windows files under "/mnt/c/".+  - Open your WSL instance/Terminal and navigate to the folder called ''nig''. If you are using WSL you can find all the windows files under "/mnt/c/".
   - ''docker compose up''   - ''docker compose up''
   - Open the individual application locally:   - Open the individual application locally:
Line 33: Line 33:
   - Now double-click on the node you just dropped. Because you never used it you will have to connect to a new server. Just click on the little pen on the right side of "Server". Here you will have to type in all needed information. These are the same, never mind the group you are in.      - Now double-click on the node you just dropped. Because you never used it you will have to connect to a new server. Just click on the little pen on the right side of "Server". Here you will have to type in all needed information. These are the same, never mind the group you are in.   
     * Version: 2.0     * Version: 2.0
-    * URL: http://influxdb:8086 +    * URL: ''http://influxdb:8086'' 
-    * Token: influx (!This is just for demonstration purposes, in production, you should generate a custom token in the InfluxDB UI!)+    * Token: ''influx'' (!This is just for demonstration purposes, in production, you should generate a custom token in the InfluxDB UI!)
     * Uncheck "Verify Server Certificate"     * Uncheck "Verify Server Certificate"
-    * Organisation: unicaes +    * Organisation: ''unicaes'' 
-    * Bucket: workshop +    * Bucket: ''workshop'' 
-    * Measurement: Make up something nice - this is where you will find your data+    * Measurement: Makeup something nice - this is where you will find your data
   - Click on save. The database is now saved in node-red and you can use it on every influxdb-node you want to. If you want to, you can delete the node we just created.   - Click on save. The database is now saved in node-red and you can use it on every influxdb-node you want to. If you want to, you can delete the node we just created.
   - Drag in a "mqtt in"-node and connect it to our just created influx node. Double-click to open its settings.   - Drag in a "mqtt in"-node and connect it to our just created influx node. Double-click to open its settings.
Line 51: Line 51:
   * [[https://docs.influxdata.com/influxdb/v2.7/|Some Guides - Documentation]]   * [[https://docs.influxdata.com/influxdb/v2.7/|Some Guides - Documentation]]
  
 +  - Open up your [[http://localhost:8082/|Influx]] instance. You can log in with the username ''influx'' and the password ''influxDB''
 +  - On the left-hand side you will find a sidebar. Click on the little graph symbol which is the Data Explorer
 +  - The Data Explorer can be used to review your data and help with developing new database queries. For this tutorial it is very easy to use:
 +    - In the ''FROM'' column you need to select the bucket which you want to read out. In this case ''workshop''
 +    - Then in the second column you can select the measurement that you want to read out
 +    - As we are saving only one simple number in the database, you must select ''value'' in the last column
 +    - Click ''SUBMIT'' to have a look at your data in a nice graph
 +  - For use in Grafana we will now need to copy the actual query that we just built with the help of the handy query builder. To get this query you need to click ''SCRIPT EDITOR''. Copy the complete query that is now shown. We will need it later.
  
 ===== 4. Grafana ===== ===== 4. Grafana =====
Line 59: Line 67:
   * [[https://grafana.com/docs/grafana/latest/getting-started/getting-started/|Getting started]]   * [[https://grafana.com/docs/grafana/latest/getting-started/getting-started/|Getting started]]
  
 +  - Open up your [[http://localhost:8081/|Grafana]] instance. You can log in with the username ''grafana'' and the password ''grafana''
 +  - Then before we can get started with creating our nice graphs, we need to create a data source. Of course, our data source will be our influx database. Open the burger menu on the left-hand side. As one of the last options you will find the ''Connections''. Click that.
 +  - It will now ask you to create a new connection. So search for ''Influx'' and click the upcoming ''InfluxDB'' option. In the top right corner, you can then select ''Add new data source''.
 +  - As a query language we want to select ''Flux''
 +  - Now we need to fill in some of the information we used before in NodeRed as well. Just for documentation here they are again:
 +    - HTTP - URL: ''http://influxdb:8086''
 +    - InfluxDB details:
 +      - Organisation: ''unicaes''
 +      - Token: ''influx'' (!This is just for demonstration purposes, in production, you should generate a custom token in the InfluxDB UI!)
 +      - Default bucket: ''workshop''
 +  - Click ''Save & test''. There should be no error and we can continue with creating our first graph. Grafana should give you a little success message. In this message, you can click ''building a dashboard''.
 +  - Before we start, lets make sure to save our Dashboard first. For that just click the ''Save'' icon in the top bar. Give it a nice name and hit ''Save''.
 +  - After doing that, we can now finally click the big blue button ''+ Add visualization''. In the upcoming pop-up, we need to choose the just-created data source.
 +  - Now we are in the UI where we can create our graph. At the bottom of the screen, you can see a text box. In this text box, we need to paste in the query we created earlier. If you click out of the text box this should already show us our graph!!
 +  - The next steps are pretty self-explanatory. First, you can for example change the name of the graph. All of the options for modifying the graph can be found in that menu. Just go through them. Most of them are easy to understand like Unit, Min, Max, etc. Play around and have fun!
 +  - To save the graph just click ''Save'' in the top right corner and don't forget to save the dashboard again as well.
 +
 +That's basically it! You now have your first dashboard that shows YOUR sensor data from a sensor that YOU developed and built! Now there is a lot more to come. Just think of something you want to build and try to do it. We just gave you a brief introduction to the world of IoT.
  
 ===== Recording ===== ===== Recording =====
latinet/unicaes/workshops/nig.1693526772.txt.gz · Last modified: 2023/09/01 02:06 by jan.sonntag