Bereits vor einer Weile habe ich auf „The Linux Terminal“ folgenden Artikel gefunden: http://www.thelinuxterminal.com/raspberry-pi-b-cpu-gpu-temperature-monitor-bash-script-source-code/
Zwischenzeitlich habe ich das Beispielskript etwas angepasst:
#!/bin/bash #Raspberry Pi Temperature Monitor #Built by Zeus-www.thelinuxterminal.com #For more info, drop a mail: office@thelinuxterminal.com # http://www.thelinuxterminal.com/raspberry-pi-b-cpu-gpu-temperature-monitor-bash-script-source-code/ cpugpu_logfile="/var/log/`hostname`_cpugpuTemp-$(date "+%Y-%m").log" get_date=$(date +%d/%m/%y) get_time=$(date +%H:%M) cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp | cut -d '=' -f2) cpuTemp1=$(($cpuTemp0/1000)) cpuTemp2=$(($cpuTemp0/100)) cpuTempM=$((cpuTemp2 % $cpuTemp1)) gpuTemp=$(/opt/vc/bin/vcgencmd measure_temp | cut -d '=' -f2) gpuTemp=`echo NULL | sed -e "s/'C//"` get_date_time=$(date "+%Y-%m-%d_%H:%M:%S") echo "NULL cpuTemp: NULL.NULL" >> $cpugpu_logfile echo "NULL gpuTemp: NULL" >> $cpugpu_logfile
Das script wird nun via Crontab aufgerufen und schreibt die Daten in die Datei.
Mir rsync hole ich das geschriebene Logfile von meinem FHEM Server ab und kann es nun mit folgender gplot Datei den Temperaturverlauf grafisch darstellen.
############################
# Display the measured temp of CPU and GPU
# Corresponding FileLog definition:
# Example Log
#2015-09-18_09:09:44 cpuTemp: 43.3
#2015-09-18_09:09:44 gpuTemp: 43.3
set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set ytics nomirror
#set y2tics
set ytics
#set yrange [:60]
#set y2range [30:50]
set title '<L1>'
set grid xtics ytics
set y2label "Temperatur in °C"
set ylabel "Temperatur in °C"
#FileLog 3:cpuTemp:0:
#FileLog 3:gpuTemp:0:
plot \
"< awk '/cpuTemp/{print $1, $3}' <IN>"\
using 1:2 axes x1y1 title 'CPU Temperatur' with lines lw 1,\
"< awk '/gpuTemp/{print $1, $3}' <IN>"\
using 1:2 axes x1y1 title 'GPU Temperatur' with lines lw 1
Das Ergebnis:
Ziel ist es nun herauszufinden wie sich der Server bei geschlossenen Gehäuse verhält und ob ich noch Kühlkörper für den Raspberry besorgen und/oder einen Lüfter in das Gehäuse einbauen muss.























