Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Script temperature logger | How to figgure out the system temperatures

Featured Replies

Hello all,

 

Currently I'm running Unraid V6.12.14 with the apps:

- ITE IT87 Driver

- Nuvoton NCT6687 Driver

- Dynamix System Autofan

- Dynamix System Temp

 

I have searched for directories related to hardware info, e.g. the temperatures which are displayed in the dashboard:
 

```bash
find /sys -type d -name "*hw*"
find: ‘/sys/kernel/slab’: Input/output error
/sys/class/hwmon
/sys/devices/platform/it87.2592/hwmon
/sys/devices/platform/it87.2592/hwmon/hwmon3
/sys/devices/platform/coretemp.0/hwmon
/sys/devices/platform/coretemp.0/hwmon/hwmon2
/sys/devices/pci0000:00/0000:00:1d.1/0000:06:00.0/nvme/nvme0/hwmon1
/sys/devices/virtual/thermal/thermal_zone0/hwmon0
/sys/devices/virtual/misc/hw_random
/sys/module/hwmon_vid
```

 

I am wondering where the temperatures of the disks in the array are stored. Anyone has an idea? I don't want to read out the specs using smartctl, since the values should be already available somewhere.

 

Why I am doing this?

I want to record the temperatures of system, in order to optimize the airflow/cooling within the case. Therefore I have wrote a little script, which selects the specific temperatures of my components:

#!/usr/bin/bash
# Version 2
# Better performing temperature logger than logging
# with $(sensors | awk '/CPU Temp/ {print $3}').
# This script gets the current temperature values
# and sleeps (sleep_interval) for 10s
# Usage:
# bash temp_loggerV2.sh <test_period> <specs>
#
# Example, logging for 60 seconds and specifying
# an idle system:
# bash temp_loggerV2.sh 60 idle
#
# Tested on Unraid V6.12.14

# Operants
test_period=$1
specs=$2
sleep_interval=10
if ((test_period<sleep_interval));then
	test_period=$((10/sleep_interval))
else
	test_period=$((test_period/sleep_interval))	
fi
logdir=/boot/config/plugins/stresstest

# Variables
path_T_cpu="/sys/devices/platform/it87.2592/hwmon/hwmon3/temp2_input"
path_T_main="/sys/devices/virtual/thermal/thermal_zone0/hwmon0/temp1_input"
path_T_nvme="/sys/devices/pci0000:00/0000:00:1d.1/0000:06:00.0/nvme/nvme0/hwmon1/temp1_input"
T_cpu=0
T_main=0
T_nvme=0
sum_T_cpu=0
sum_T_main=0
sum_T_nvme=0

# Messages
msg_head="Measurement\tT_cpu / (k°C)\tT_main / (k°C)\tT_nvme / (k°C)\n"
msg_line="==============================================================\n"

# Verifying stresstest log directory & creating logfile
if [[ ! -d "$logdir" ]]; then
  mkdir "$logdir"
fi
log_filename=${logdir}/$(date +%Y%m%d_%H%M%S)_temperature_${specs}.log
touch $log_filename

# Temperature logger function
record_temps() {
	test_period=$1
	printf "${msg_head}" | tee -a ${log_filename}
	printf "${msg_line}" | tee -a ${log_filename}
	for ((i = 0 ; i < "${test_period}" ; i++)); do
		# CPU
		T_cpu=$(cat $path_T_cpu)
		sum_T_cpu=$(echo ${sum_T_cpu} ${T_cpu} | awk '{print $1 + $2}')

		# Mainboard
		T_main=$(cat $path_T_main)
		sum_T_main=$(echo ${sum_T_main} ${T_main} | awk '{print $1 + $2}')

		# NVME
		T_nvme=$(cat $path_T_nvme)
		sum_T_nvme=$(echo ${sum_T_nvme} ${T_nvme} | awk '{print $1 + $2}')

		# Logging
		printf "${i}\t\t${T_cpu}\t\t${T_main}\t\t${T_nvme}\n" | tee -a ${log_filename}
		sleep $sleep_interval
	done
	# Average
	avg_T_cpu=$(awk -v var1=$sum_T_cpu -v var2=$test_period 'BEGIN { print  ( var1 / var2 / 1000 ) }')
	avg_T_main=$(awk -v var1=$sum_T_main -v var2=$test_period 'BEGIN { print  ( var1 / var2 / 1000 ) }')
	avg_T_nvme=$(awk -v var1=$sum_T_nvme -v var2=$test_period 'BEGIN { print  ( var1 / var2 /1000 ) }')
	printf "${msg_line}" | tee -a ${log_filename}
	echo "Average CPU temperature: ${avg_T_cpu}°C" | tee -a ${log_filename}
	echo "Average Mainboard temperature: ${avg_T_main}°C" | tee -a ${log_filename}
	echo "Average NVME temperature: ${avg_T_nvme}°C" | tee -a ${log_filename}
}

record_temps ${test_period}
printf "Log was written to $log_filename\n"

 

Anyone who want to use it, has to change the variables path_T_cpu, path_T_main and path_T_nvme according to his/her system. Running it via User scripts destroys the tab seperators, but the log is still readable. The log is stored under /boot/config/plugins/stresstest/<YYYYMMDD_HHMMSS>_temperature_<specs>.log.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.