IoT Open Basic

Basic course for IoT Open developers and integrators.


Chapter 6

“It would be really nice with some cosy relevant quote here!”
― IoT Open Developer

IoT Open is a platform for IoT applications. Without applications, you really can't do that much with it. However, more than enough (for the most of us) is already built, and is free. Let's start with Grafana.

Grafana

Grafana is a very competent tool for showing and analyzing data. With the IoT Open data source it is very easy to graph logged data from IoT Open.

Installing grafana

Grafana can be installed in many different ways. The easiest, if you have the IoT Open Virtual Appliance available, is to log in and run the command ./start-grafana.sh in the home catalog of the iot user.

iot@iot-open:~$ ./start-grafana.sh 

Grafana is then downloaded and started, it will also install the IoT Open Datasource plugin ready for you to use. Access it using http://<The IP of the virtual appliance>:3000 in my case http://192.168.56.102:3000/.

If you don't have the IoT Open Appliance but have docker installed the command looks like this:

docker run -d -p 3000:3000 \
  -e "GF_INSTALL_PLUGINS=https://github.com/IoTOpen/grafana-datasource-lynx/archive/2.2.1.zip;iotopen-datasource" \
  -e "GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=iotopen-datasource" --name=Grafana grafana/grafana:latest

There are more options available, but these should be enough for now. Please note that the changes you do in Grafana will not be persistent but only saved in the docker container. In the appliance changes will be persistent within the virtual machine. Access it using http://<The IP of the host running it>:3000.

Login for the first time

Login using username admin and password admin you will be prompted for a new password. You will come to welcome page with some information from our friends at Grafana.

Configuring the IoT Open datasource

In this section you will need an API Key, but that's not a problem since you now know how to make one.

  • In the menu to the left (in most browsers) there is a cog icon. Click on and choose Data Sources (the first option).

  • Click on "Add data source"

You will get a list of possible data sources and at the very bottom you will see the IoT Open Datasource.

  • Click on Select

  • In the box that opens there are some fields to fill in. Type the following

Name: Leave as is and select Default
Url: https://lynx.iotopen.se
API Key: your key

  • Click on Save & Test and you should see a green bar telling you that all is good!

That's it. Now Grafana is ready!

Creating your first dashboard

The Grafana integration and also som other integrations only lists Installation that are assigned to your account. Therefore you need to make sure the checkbox "Assign to me" is checked in the installation.

Currently, there isn't that much data to play with. But if you have followed this course and didn't skip some exercises, there should be at least some data since you tried the data fiddler at the end of chapter 2.

Let's see if we can graph that data even though it currently might be just a dot ...

  • In the left menu there is a plus sign, click on it and choose Dashboard.

A new empty dashboard is created for you.

  • Click on "add an empty panel"

You will now be presented with an empty graph and an editor area. In the editor area you should see that the IoT Open Datasource is chosen and that your installation is chosen under Query A (since there is only one installation).

Under the installation you are presented with several options. The first part is a filter function where you can add filters to your data. Please observe that every line reduces the amount of data shown in the graph.

Start with removing all filters by klicking the red cross by the first default filter. All data from your installation in the selected time frame should now be visible. If the graph is empty please select another time frame. Try 30 days for example.