Aroy-Art-Site/content/blog/2022-04-06-collect-raspberrypi-cpu-&-gpu-temp-with-telegraf.md

1.6 KiB

title date lastmod image description tags draft slug
Collect Raspberry Pi CPU & GPU temp with Telegraf 2022-04-06T10:05:08.281Z 2024-02-12T07:50:48.484Z /images/blog/8RLV4tpYwkRSyWbM.webp How to collect Raspberry Pi CPU and GPU temperature with Telegraf to later display it in a nice Grafana Dashboard.
Linux
Monitoring
false collect-raspberry-pi-cpu-gpu-temp-telegraf

Collect Raspberry Pi CPU & GPU temperature with Telegraf

How to collect Raspberry Pi CPU and GPU temperature with Telegraf to later display it in a nice Grafana Dashboard.

How to use (No script required)


1. Add this to you telegraf.conf

[[inputs.file]] 
  files = ["/sys/class/thermal/thermal_zone0/temp"]
  name_override = "cpu_temperature"
  data_format = "value"
  data_type = "integer"
  
[[inputs.exec]]
  commands = [ "/opt/vc/bin/vcgencmd measure_temp" ]
  name_override = "gpu_temperature"
  data_format = "grok"
  grok_patterns = ["%{NUMBER:value:float}"]

2. Add telegraf user to video group

For telegraf to be able to get the GPU temp the telegraf user needs to be add to the video group. Do so with the command below:

sudo usermod -a -G video telegraf

Run the test with:

telegraf -config /etc/telegraf/telegraf.conf -test

4. Restart telegraf service

Restart telegraf to activate the new settings.

sudo systemctl restart telegraf.service

5. Check that everything is working

Double check that everything is working in order

sudo systemctl status telegraf.service