Now, put "InfluxDB + Telegraf + Chronograf" in CentOS8 and try to control the temperature of multiple Raspberry pi4.

I want to control the temperature of Raspberry Pi 4B

There are multiple Pi4s with explosive heat, and I was worried about the CPU temperature during the hot summer, so I had no choice but to hit vcgencmd measure_temp in 2020. I was told that it's easier to use "Chronograf", but the procedure is messy, isn't it? I left it ww.

"InfluxDB + Telegraf + Chronograf" Is it delicious now?

InfluxDB is an open source time series database developed by InfluxData. Telegraf + Chronograf is also developed by this company, so it's relatively easy to build.

By the way, Telegraf is a metrics collector dedicated to InfluxDB. Chronograf is a visualization dashboard framework dedicated to InfluxDB.

Maybe, but easier than doing it with (NET-SNMP + MRTG). This is recommended.

Constitution

Let's make it like this. CentOS8 : InfluxDB , Chronograf Pi4B : Telegraf InfluxDB : influxdb-1.8.3.x86_64.rpm Chronograf : chronograf-1.8.5.x86_64.rpm Telegraf : telegraf-1.15.3-1.x86_64.rpm / telegraf-1.15.3

It looks like the figure below

image.png

Install InfluxDB, Chronograf on CentOS

InfluxDB may be powerless with Pi? Since I read the article, InfluxDB, Chronograf will try to insuko on the side with a little power.

InfluxDB installation

You can download rpm and install it, but the yum command is easier, so create the following file.

/etc/yum.repos.d/influxdb.repo


[influxdb]
name = InfluxDB Repository
baseurl = https://repos.influxdata.com/rhel/8/x86_64/stable/
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key

Install with yum. only this.

$ sudo dnf makecache
$ sudo yum install influxdb
$ systemctl enable --now influxdb.service

You will be able to create a database using the influx command. InfluxDB also requires a firewall configuration to use the 8086 port.

What is the time series database InfluxDB?

Install Chronograf

I'll put this from the rpm package. Chronograf requires a firewall configuration to use port 8888.

$ wget https://repos.influxdata.com/rhel/8/x86_64/stable/chronograf-1.8.5.x86_64.rpm
$ sudo yum localinstall chronograf-1.8.5.x86_64.rpm
$ sudo systemctl enable --now chronograf
$ sudo systemctl status chronograf

Install it for the time being and set it later.

Install Telegraf on CentOS / Pi4

Install the Telegraf agent on the OS you want to monitor. Note that the command to inscore is slightly different from CentOS / Pi4.

Install Telegraf on CentOS

Modify the configuration file

$ wget https://repos.influxdata.com/rhel/8/x86_64/stable/telegraf-1.15.3-1.x86_64.rpm
$ sudo yum localinstall telegraf-1.15.3-1.x86_64.rpm
$ sudo systemctl enable --now telegraf
$ sudo systemctl status telegraf

Install Telegraf on Pi4

$ sudo curl https://repos.influxdata.com/influxdb.key | apt-key add -
$ sudo vi /etc/apt/sources.list.d/influxdb.list

deb https://repos.influxdata.com/debian buster stable

$ sudo apt update
$ sudo apt install telegraf
$ sudo systemctl enable --now telegraf
$ systemctl status telegraf.service

Modify telegraf.conf

Make the minimum settings for telegraf.conf. I don't think it's difficult.

/etc/telegraf/telegraf.conf


[agent]
  urls = ["http://192.xxx.yyy.zzz:8086"]  #InfluxDB instrumented IP
  database = "telegraf"
  retention_policy = ""
  write_consistency = "any"
  timeout = "5s"

after that. Reboot (if troublesome).

Try starting Chronograf

Try starting Chronograf. Access port 8888. I have a feeling of refusal because it doesn't support Japanese, but let's do our best here.

[First Chronograf that is easy to understand](https://www.ultra-noob.com/blog/2020-04-02-%E3%82%84%E3%81%9F%E3%82%89%E5 % 88% 86% E3% 81% 8B% E3% 82% 8A% E3% 82% 84% E3% 81% 99% E3% 81% 84% E5% 88% 9D% E3% 82% 81% E3% 81 % A6% E3% 81% AEchronograf /)

If the Telegraf agent is running, you should see something like this:

image.png

Raspberry pi4 temperature control

Since the Raspberry pi has a temperature sensor, let's create a command to register the CPU temperature in InfluxDB via the Telegraf agent. I thought that the threshold was high, but it was relatively easy, so it should be applicable in various ways.

・ [[Raspberry Pi + InfluxDB + Telegraf] How to record the CPU temperature of Raspberry Pi](https://www.ultra-noob.com/blog/2020-08-29-%E3%80%90Raspberry%20Pi% 20_% 20InfluxDB% 20_% 20 Telegraf% E3% 80% 91% E3% 83% A9% E3% 82% BA% E3% 83% 91% E3% 82% A4% E3% 81% AECPU% E6% B8% A9% E5% BA% A6% E3% 82% 92% E8% A8% 98% E9% 8C% B2% E3% 81% 99% E3% 82% 8B% E6% 96% B9% E6% B3% 95 /) ・ How to measure a Raspberry Pi's temperature and CPU frequency with Telegraf

It's a tankopi, but this kind of thing needs to be experienced. / usr / local / bin / rpi-temp Create a file.

#!/bin/bash

awk '{print $1/1000}' /sys/class/thermal/thermal_zone0/temp

Next, switch to execution mode. I'll hit it. The value comes out. I need this.

$ cd /usr/local/bin
$ sudo chmod 755 rpi-temp
$ ./rpi-temp
44.79

If you can confirm this state, put the following near the end of /etc/telegraf/telegraf.conf.

/etc/telegraf/telegraf.conf


[[inputs.exec]]
  commands = ["/usr/local/bin/rpi-temp"]
  name_override = "rpi_temp"
  data_format = "value"
  data_type = "float"

After that, restart the Telegraf agent. You don't have to restart pi4.

$ systemctl restart telegraf.service

Check if the temperature sensor information of pi4 is available on Chronograf.

image.png

Wow, super easy than setting MRTG.

Summary for the time being

How To Install InfluxDB on CentOS 8 / RHEL 8Obtain a subr resource with Telegraf and store it in InfluxDB[Comparison] Grafana vs. Chronograf --Compare visualization tools-Build a monitoring environment with TICK stack (Telegraf + InfluxDB + Chronograf + Kapacitor)[Preparation for Iot home environment] Setting of database InfluxDB to save sensed data with Raspberry PiSpring boot metrics monitoring using TICK stack

Recommended Posts

Now, put "InfluxDB + Telegraf + Chronograf" in CentOS8 and try to control the temperature of multiple Raspberry pi4.
Try scanning, analyzing, and transmitting the remote control of Mitsubishi's air conditioner with Raspberry Pi
Put Kanban in Docker of Raspberry Pi 3
[Raspberry Pi] Try to link Apache2 and Tomcat
Just plug in the storage and power to run the Raspberry Pi (Ubuntu Server Edition)
802.1X authentication to the network of Bonding setting in CentOS7
Graph the sensor information of Raspberry Pi in Java and check it with a web browser
When I try to put centos in VMware, pane is dead
How to set the IP address and host name of CentOS8
Try putting CentOS 8 on Raspberry Pi 3
The story of forgetting to close a file in Java and failing
Confirmation and refactoring of the flow from request to controller in [httpclient]
How to change the maximum and maximum number of POST data in Spark
Is it possible to put the library (aar) in the Android library (aar) and use it?