In setting up the infrastructure for monitoring sensors made up of ESP8266 devices in previously published articles
Mqtt with Beaglebone ed ESP8266 – Freeboard
Freeboard had been set up to display the data coming from the sensors.
In this new series of articles, we set up Grafana
as environment to view the data of the various sensors.
We implement the environment, in this case, on an Orange Pi PC board, but other arm or pc system can be used.
Below the architecture used in this series of articles
In these articles we’ll use the maximum authorizations for each environment, we will not use authorizations on mosquitto and no encrypted connections will be used. In a test environment this setting is fine, but in an operating environment it is necessary to set up the correct authorizations and possibly the encryptions in the connections in all environments.
We have installed our compiled version of Debian 9 Stretch for Orange PI PC. The image used is the following
The monitor user was created during the Image setup, while the hostname was renamed in dashboardora. If not installed proceed to install the avahi daemon
1 |
sudo apt-get install avahi-daemon |
In this way the services can be accessed by publishing the hostname, i.e. dashboardora.local.
Using the armbian utilities disable ip6 on the system; to carry out this setting launch armbian-config
1 |
sudo armbian-config |
As a first step we install the mqtt broker mosquitto
1 2 |
sudo apt-get install mosquitto sudo apt-get install mosquitto-clients |
Install the http services and the databases Mysql and MySqlWorkbench
Apache2
1 |
sudo apt-get install apache2 |
and various prerequisites
1 |
sudo apt-get install libapache2-mod-php |
Start apache
1 |
sudo systecmtl start apache2 |
and check that the server responds to the web address, which in our case corresponds to http://dashboardora.local
MySql
1 |
sudo apt-get install mysql-server mysql-client |
Debian 9 comes with MariaDB; you must set the password for the database administration user root with the following command
1 2 |
sudo systemctl start mysql sudo mysql_secure_installation |
We set the root password and the ability to log in from other hosts as root
The other chosen options are listed below
We install phpmyadmin for database management
1 |
sudo apt-get install phpmyadmin |
At the next screen choose apache2
Run the commands listed below
1 2 3 4 |
sudo mysql -u root -p mysql update user set plugin=' 'where user='root'; flush privileges; exit |
Check that the system works correctly by accessing via web browser by adding to the apache phpmyadmin address, in our case
http://dashboardora.local/phpmyadmin
Log in with the database root credentials.
Mariadb must be enabled to accept connections from other hosts. To do this, go to the folder
1 |
/etc/mysql/mariadb.conf.d |
and edit the 50-server.cnf file as root, changing the setting
1 |
bind-address= 127.0.0.1 |
in
1 |
bind-address= 0.0.0.0 |
To allow the root database user to be able to access from an external client, it is necessary to log on mariadb locally with his client and enable this option; therefore the following is performed
1 2 3 4 5 6 7 8 |
mysql -u root -p GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION; FLUSH PRIVILEGES; exit |
Mysql Workbench Installation on PC
Go to the following link
and download the version for your operating system; proceed with the installation.
For Linux the package is also available in the distribution repositories.
After configuring the connection, you access the MySql system control screen.
In the next article we will continue the installation of the other components to be able to monitor the sensors