Actually tested the hddtemp and sensors regexp against both debian 10 and 11 now
This commit is contained in:
parent
506a94a402
commit
ddf19529c1
1 changed files with 13 additions and 5 deletions
|
|
@ -196,8 +196,8 @@ while () {
|
||||||
# could just be a simple pipe, but hddtemp has a strong posibility
|
# could just be a simple pipe, but hddtemp has a strong posibility
|
||||||
# to be stuck in a D state, and hold STDERR open despite a kill
|
# to be stuck in a D state, and hold STDERR open despite a kill
|
||||||
# -9, so instead just send it to a tempfile, and read from that tempfile
|
# -9, so instead just send it to a tempfile, and read from that tempfile
|
||||||
system("timeout -k 1 20 hddtemp /dev/sd? | grep -v 255 > $tempfilename");
|
system("timeout -k 1 20 hddtemp /dev/sd? > $tempfilename");
|
||||||
@hddtemps=`grep [0-9] < $tempfilename`;
|
@hddtemps=`cat < $tempfilename`;
|
||||||
}
|
}
|
||||||
if (!@ambient_ipmitemps) {
|
if (!@ambient_ipmitemps) {
|
||||||
@ambient_ipmitemps=`timeout -k 1 20 ipmitool sdr type temperature | grep "$ipmi_inlet_sensorname" | grep [0-9] || echo " | $ambient_temp degrees C"` # ipmitool often fails - just keep using the previous result til it succeeds
|
@ambient_ipmitemps=`timeout -k 1 20 ipmitool sdr type temperature | grep "$ipmi_inlet_sensorname" | grep [0-9] || echo " | $ambient_temp degrees C"` # ipmitool often fails - just keep using the previous result til it succeeds
|
||||||
|
|
@ -205,16 +205,24 @@ while () {
|
||||||
@coretemps=`timeout -k 1 20 sensors | grep [0-9]`;
|
@coretemps=`timeout -k 1 20 sensors | grep [0-9]`;
|
||||||
@cputemps=grep {/^Package id/} @coretemps;
|
@cputemps=grep {/^Package id/} @coretemps;
|
||||||
@coretemps=grep {/^Core/} @coretemps;
|
@coretemps=grep {/^Core/} @coretemps;
|
||||||
|
# filter in numbers only and remove all extraneous output, and some
|
||||||
|
# devices permanently return a *temperature* of 255, so filter them
|
||||||
|
# out too.
|
||||||
|
@hddtemps=grep {/[0-9]/ && !/255/} @hddtemps;
|
||||||
|
|
||||||
chomp @cputemps;
|
chomp @cputemps;
|
||||||
chomp @coretemps;
|
chomp @coretemps;
|
||||||
chomp @ambient_ipmitemps;
|
chomp @ambient_ipmitemps;
|
||||||
chomp @hddtemps;
|
chomp @hddtemps;
|
||||||
|
|
||||||
@cputemps = apply { s/.*: *([^ ]*)[.°]C.*/$1/ } @cputemps;
|
# apply from List::MoreUtils
|
||||||
@coretemps = apply { s/.*: *([^ ]*)[.°]C.*/$1/ } @coretemps;
|
|
||||||
|
# "..?C" refers to single octet ascii degree symbol that old
|
||||||
|
# versions used to output, and 2 octet unicode degree symbol
|
||||||
|
@cputemps = apply { s/.*: *([-+0-9.]+)..?C\b.*/$1/ } @cputemps;
|
||||||
|
@coretemps = apply { s/.*: *([-+0-9.]+)..?C\b.*/$1/ } @coretemps;
|
||||||
@ambient_ipmitemps = apply { s/.*\| ([^ ]*) degrees C.*/$1/ } @ambient_ipmitemps;
|
@ambient_ipmitemps = apply { s/.*\| ([^ ]*) degrees C.*/$1/ } @ambient_ipmitemps;
|
||||||
@hddtemps = apply { s/.*: *([^ ]*)[.°]C.*/$1/ } @hddtemps;
|
@hddtemps = apply { s/.*: *([-+0-9.]+)..?C\b.*/$1/ } @hddtemps;
|
||||||
#FIXME: it is more important to keep hdds cool than CPUs. We should
|
#FIXME: it is more important to keep hdds cool than CPUs. We should
|
||||||
#put differnt offsets on them - possibly as easily as adding "10" to
|
#put differnt offsets on them - possibly as easily as adding "10" to
|
||||||
#hddtemp (but need to work out how to keep log output sane)
|
#hddtemp (but need to work out how to keep log output sane)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue