Collect RaspberryPi CPU and GPU temperature with telegraf
Collect RaspberryPi CPU and GPU temperature with telegraf
vcgencmd
binary by executing shell command /usr/bin/which vcgencmd
. Location may vary depending on libraspberrypi-bin
package version.replace_with_vcgencmd_location
with real path returned in previous step. (ex./usr/bin/vcgencmd
).[[inputs.file]]
files = ["/sys/class/thermal/thermal_zone0/temp"]
name_override = "cpu_temperature"
data_format = "value"
data_type = "integer"
[[inputs.exec]]
commands = [ "replace_with_vcgencmd_location measure_temp" ]
name_override = "gpu_temperature"
data_format = "grok"
grok_patterns = ["%{NUMBER:value:float}"]
sudo usermod -a -G video telegraf
sudo service telegraf stop;sudo service telegraf start
telegraf -config /etc/telegraf/telegraf.conf -test
telegraf_pi_temp.sh
to /usr/local/bin/telegraf_pi_temp.sh
chmod +x /usr/local/bin/telegraf_pi_temp.sh
telegraf
user to video group sudo usermod -a -G video telegraf
sudo service telegraf restart
or sudo reboot
telegraf.conf
telegraf -config /etc/telegraf/telegraf.conf -test
To get a human readable cpu temperature divide it by 1000 (in grafana use the math(/ 1000) function
{"cpu":54768, "gpu":54.8}