Grafana Howto: From B.One Middleware via MQTT to InfluxDB

– 📖🕓 ≈ 5 min – In the last articles you have already been given a small introduction to the open source tool Grafana. It was also reported how to install…
– 📖🕓 ≈ 4 min – The article “Open Source Tool Grafana – An Introduction” has already described what kind of tool it is and what you can basically do with…
– 📖🕓 ≈ 3 min – We introduced and described Grafana in the previous articles “Open Source Tool Grafana – An Introduction” and “Grafana Howto: Local Installation & Setup Using Ubuntu…
– 📖🕓 ≈ 4 min – In the digital age, the monitoring and display of systems and databases, both in private and in business, are very popular and almost fundamental. Therefore…
– 📖🕓 ≈ 6 min – As a continuation of our small series of articles on the open source tool Grafana, we would like to show you today, using the free…
wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/os-release
echo "deb https://repos.influxdata.com/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
Updated and installed the appropriate packages: sudo apt update
sudo apt install -y influxdb telegraf
I recommend you to start InfluxDB with your system's boot process: sudo systemctl unmask influxdb.service
sudo systemctl start influxdb.service
sudo systemctl enable influxdb.service
sudo systemctl start telegraf.service
sudo systemctl enable telegraf.service
To use your InfluxDB, simply start the Influx Client and set up a database and a user. In this example we set up a database for Telegraf data with a user for Telegraf and Grafana.
Replace name and password with your own information. Start client: influx
Set up database and users: create database telegraf_b_one
use telegraf_b_one
create user telegraf with password ''
grant all on telegraf_b_one to telegraf
create user grafana with password ''
grant read on telegraf_b_one to grafana
Finally, we check whether everything has been created correctly and close the InfluxDB Client. To do this, enter the following commands in your terminal: show databases
show users
show grants for telegraf
show grants for grafana
quit
Before we go any further, you need to make a few small changes in Telegraf's configuration. To do this, open the telegraf.conf in an editor such asF nano: sudo nano /etc/telegraf/telegraf.conf
Now look for the following entries in the " Configuration for sending metrics to InfluxDB " area and edit them accordingly. Replace the login data "username" and "password" with the information you selected above. database = "telegraf_b_one" # required
username = "admin"
password = "password"
Remember that all changed parameters have to be commented out with the "#" and don't forget to save at the end.servers = [“tcp://xxxxxxxx:port] --> URL und Port eures Brokers
topics = [“xxxxxx”] --> die Topics, die euch euer Broker für den Sensor bereitstellt
username = “my_user” --> Username zur Authentifizierung gegenüber Broker
password = “my_password” --> Passwort zur Authentifizierung gegenüber Broker
data_format = “json” --> Datenformat
The information mentioned above are the parameters to be edited in any case. Depending on your broker and your requirements, additional parameters may be required.
Here, too, the "#" must be deleted for each changed parameter. It is best to close Telegraf and InfluxDB again after saving the file and start the services again. Either by rebooting your system or using these entries in the terminal: sudo systemctl stop influxdb.service
sudo systemctl stop telegraf.service
If both system services are stopped, you can start them again with the following commands: sudo systemctl start influxdb.service
sudo systemctl start telegraf.service
If you have done everything correctly, no error messages should appear when starting the system services. As soon as one of your sensors transmits values, these are passed on to your installation via the MQTT Broker and stored in the InfluxDB.COOKIES: