changeset 34:fb4dd1974129

Ensure fixed ordering of values Also ensures we don't get ACPI readings
author IBBoard <dev@ibboard.co.uk>
date Sat, 27 Feb 2021 15:57:09 +0000
parents 6e30e90527d6
children 5697821137de
files sensors-record
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sensors-record	Sat Feb 27 15:40:41 2021 +0000
+++ b/sensors-record	Sat Feb 27 15:57:09 2021 +0000
@@ -36,9 +36,12 @@
 
 while true
 do
-	SENSORS=$(sensors | grep '^\(fan\|temp\|Core\)' | tail -n+3 | sed 's/Core /Core/g; s/^\([^:]\+\): [^0-9\.]*\([0-9\.]\+\)[^ ]*/\1 \2/g' | awk '{printf "%s:", $2}')
+	# We can't guarantee order, so sort the results
+	# People also report that the ACPI sensor is unreliable, so only take temps with "low" properties, which ACPI seems to lack
+	SENSORS=$(sensors | grep '^\(fan\|temp.*low\|Core\)' | sort | sed 's/Core /Core/g; s/^\([^:]\+\): [^0-9\.]*\([0-9\.]\+\)[^ ]*/\1 \2/g' | awk '{printf "%s:", $2}')
 	GPU=$(nvidia-smi -q | grep -oE "(Fan Speed|GPU Current Temp).*"|sort -r|cut -f2 -d:|cut -f2 -d" "|tr '\n' ':')
 	# "N" means record against current timestamp
+echo $SENSORS
 	rrdtool update "${DB}" "N:${SENSORS}${GPU%:}"
 	sleep 1
 done