telegraf: add CPU temperature on Raspberry Pi

This commit is contained in:
Jannik Beyerstedt 2020-04-30 22:41:26 +02:00
parent 61c0edbd88
commit df5f0a6fc6
2 changed files with 10 additions and 0 deletions

View File

@ -17,6 +17,7 @@
state: restarted
- name: Enable and restart telegraf
become: yes
service:
name: telegraf
state: restarted

View File

@ -72,3 +72,12 @@
# ## Remove numbers from field names.
# ## If true, a field name like 'temp1_input' will be changed to 'temp_input'.
# # remove_numbers = true
{% if ansible_lsb.id == "Raspbian" %}
# On Raspbian, get CPU temperature (in millicelsius)
[[inputs.exec]]
commands = ["cat /sys/class/thermal/thermal_zone0/temp"]
data_format = "value"
data_type = "integer"
name_override = "cpu_temp"
{% endif %}