Tag Archives: nginx

Sensors Monitoring – Nodered Configuration

At this point we set nodered to read the messages on Mosquitto and insert the data into InfluxDB and MySql.

Below the json file to be imported into nodered

Nodered Json

This flow is functional to the explanation of the functioning of the architecture as a whole; the flow must be optimized by programming nodered so as to automatically generate the information of the nodes from which the data arrives without resorting to different nodes for each sensor.

To execute the import proceed as follows, after accessing nodered


and after clicking on the menu on the right, choose to import the json from the clipboard

importFlowsAt the next screen, choose to import the json file into a new flow

flowOnce imported, set the credentials to access MySql and InfluxDB, selecting Configuration nodes from the menu on the right and setting the user account and password

configureNodesThe connections to the dbs and mosquitto are shown

configureNodesDBBelow is the MySql setting, accessed by clicking the mouse twice on ESPMYSQL

MySqlSettingUpdate button updates the node.

To make the flows operational click on Deploy


Now, with nodered we take the contents of the various mqtt topics and insert them into MySql and InfluxDB.

In the next article we display these data in Grafana.

Sensors Monitoring – InfluxDB Configuration

After MySql tables creation

Sensors Monitoring – MySql Configuration

we have to create a database  on InfluxDB.

The first step is to activate an administrative user on the system, as described in the link

Authentication and Authorization

InfluxDB  is accessed from the local client by running the influx command from a shell


In the file /etc/infuxdb/influxdb.conf, using the root user or the sudo command, the auth-enabled parameter is set from false to true

Restart influxdb

Using a command shell on Debian  create the database DATAESP with the following commands

Enter the admin credentials to the auth command and proceed to create the database

Below is the result of the commands listed above


For the management of the Influxdb database, it is possible to use Chronograph


The Chronograph download is available at the link

Chronograph Download

Installation can be performed in two ways.

Application start

Log in with the monitor user and in a command shell

Start the chronograf application


Start as a Service

Log in with the monitor user; use a command shell to execute

In the /opt/chronograf/usr/lib/chronograf/scripts folder there are scripts for the automatic start of chronograf.

Here are the operations performed in our system:

  • Copy /opt/chronograf/usr/lib/chronograf/scripts/init.sh into /etc/init.d/chronograf and assign execution permissions

  • Copy /opt/chronograf/usr/lib/chronograf/scripts/chronogaf.service  into /etc/systemd/system/chronograf.service

Change in both files the user and path of the various chronograf components, i.e. change the user to monitor and the paths that point to /opt/chronograf

Below is the link to the modified files

Automatic Startup Chronograf

After the modifications run

To enable it at startup and start it run

After starting chronograf in one of the ways described above, it can be accessed via browser and port 8888


ChronografPress Get Started and set the connection and the credentials of the admin user with relative password defined before

Chronograf2conSet up the Influxdb dashboard

ChronografDashboardDo not set the Kapacitor component

Chronograf3Complete the configuration and by clicking on View All Connections

Chronograf4we access to the newly created connection


This component can be useful later to manage and monitor InfluxDB.

In the next article, we ‘ll define the rules on Nodered to populate MySql and InfluxDB databases with the data sent by the sensors

Sensors Monitoring – Nodered Configuration





Sensors Monitoring – MySql Configuration

After the software installation on Orange Pi PC we proceed to the their configuration

Sensors Monitoring – Envinronment Setup 2

Creating Tables on MySql

On MySql 3 tables have been created containing the values of temperature, humidity and pressure of the sensors.

Here is the MySql model

MySql Model

to import into MySql Workbench

ESPModelloOnce imported, access the Database-> Forward Engineering menu and import the tables on your MySql system on the Orange Pi PC, by entering the MySql root user and relative password

ESPImportAt the next screen we  use the connection created on MySql Workbench to connect to the database

ESPImport1Leave everything by default and enter the root password when prompted.

The tables are now available on the database

ESPTablesIn the next article we configure InfluxDb to store data in real time sent by the sensors

Sensors Monitoring – InfluxDB Configuration

Sensors Monitoring – Envinronment Setup 2

After the software components installation in the previous article

Sensors Monitoring – Eninronment Setup

we finish this operation with this article.


The Influxdb is installed as indicated in the link


For Debian 9 we execute the following commands

Check that everything works correctly by connecting with the infludb client



We proceed to the installation of node.js

Then we proceed to  nodered installation, as indicated at the link

Nodered installation

To run nodered at the start up, we use the script available at the following link

Nodered autostart

We did not run the automated script, but executed the following steps

Edit /etc/init.d/nodered and change the user from pi to monitor, ie change the parameter



Start  nodered

Check that nodered works by accessing the following link with the browser



Restart the system and check that nodered starts automatically.

Proceed to the installation of the nodered add-ons



We proceed to download the version for arm

Grafana for ARM

Enable and start Grafana

Access the system using the url


Log in with the user admin and password admin; change the password

GrafanaOnce the new password has been set, the setup interface is available

Grafana2In the next articles we will execute the settings to be able to view the sensors data.

Reverse Proxy installation

To access the system through port 80 of the http server we use nginx as a reverse proxy


We disable apache

We proceed to the installation of nginx

Everything must be configured to access the two systems using the following links

http://dashboardora.local/nodered for nodered

http://dashboardora.local/grafana for grafana

For Grafana we follow the official documentation

Grafana proxy

We change the file /etc/grafana/grafana.ini by modifying the domain and root_url parameters; in our file the parameteres are modified  as follows

Then we configure nginx, creating the servizi file with the following contents in the /etc/nginx/sites-available folder

Here is the link of the nginx configuration

nginx configuration

We run the following command

and start nginx and grafana services

At this point it is possible to access the two services via the links




grafana-nginxIn the next article we start the configuration of the various modules needed for the sensors monitoring

Sensors Monitoring – MySql Configuration