Last active
February 2, 2019 14:40
-
-
Save dettmering/90a449c13f10e2eb150c1ae7442c7732 to your computer and use it in GitHub Desktop.
Log the RaspberryPi temperature to InfluxDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp) | |
cpuTemp1=$(($cpuTemp0/1000)) | |
cpuTemp2=$(($cpuTemp0/100)) | |
cpuTempM=$(($cpuTemp2 % $cpuTemp1)) | |
serial=$(cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2) | |
host="localhost:8086" | |
db="rpi" | |
curl -i -XPOST "http://${host}/write?db=${db}" --data-binary "cpu_temp,serial=${serial} temperature=${cpuTemp1}.${cpuTempM}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment