Easy temp/load logging

System up successfully for just over 24 hours. Very nice w OSMC after having spent many frustrating attempts with oe and xbian over the past few evenings.

The below is used to track system load vs temperature. You might want to relocate the script and/or log to somewhere other than home. Temps are while running the SomaFM app and screensaver slide show, not enough data to mean anything.

OTA → 950Q → pi-2 with USB SATA dock as media, all enclosed in a fan-vented cabinet. If the disk also powers down, its cocktail time :smile:

Cheers,

$ ls -l temp
-r-xr-xr-x 1 osmc osmc 70 Jul 13 01:02 temp

$ cat temp

#!/bin/bash
# load + temp
echo -n "$( uptime ) "
/opt/vc/bin/vcgencmd measure_temp

osmc@raspberry:~$ crontab -l

# check temp and system load every 20 minutes
5,25,45 * * * * /home/osmc/temp >> /home/osmc/temp.log

$ cat temp.log
01:05:01 up 23:38, 1 user, load average: 0.41, 0.45, 0.42 temp=63.2’C
01:25:01 up 23:58, 0 users, load average: 0.37, 0.35, 0.41 temp=63.8’C
01:45:01 up 1 day, 18 min, 1 user, load average: 0.24, 0.22, 0.27 temp=62.1’C

hddtemp is also nice that way you can get harddrive temperatures also

Thanks. 2nd version requires apt-get smartmontools …

#!/bin/bash

DISK=$( sudo /usr/sbin/smartctl -a -d sat /dev/sda | awk '/Temp/{print $NF}' )	# USB SATA
CPU=$( /opt/vc/bin/vcgencmd measure_temp | sed "s/'C//" )

echo "$( uptime ) $CPU disk=$DISK"

Final follow up:

  • Added a parameter to only check disk temp once per hour as it was spinning up every time smartctl read the disk temp, did not test hddtemp
  • Disk idle is via ‘hdparm -S’ for thermal management
  • load average seems more useful than %CPU, ie, soma fm + slideshow generated more load/heat than channel surfing w tvheadend

The intent is to to replace my aging, home-brew Shuttle PVR setup. Next test is to see how the pi-2 does w ffmpeg transcodeing to get MPEGTS tv to a reasonable mp4-based storage and/or remote streaming upload.

Cheers,