Extract ASUS like motherboards CPU fans and temp data

https://sourceforge.net/p/webadmin/discussion/600155/thread/1b4ee640c6/
This commit is contained in:
Ilia Rostovtsev
2021-11-29 19:48:35 +03:00
parent 72b2d1d291
commit a18bf52ce0

View File

@@ -505,8 +505,8 @@ if (&has_command("sensors")) {
while (<$fh>) {
# CPU full output must have either voltage or fan data
my ($cpu_volt) = $_ =~ /in[\d+]:\s+([\+\-0-9\.]+)\s+V/i;
my ($cpu_fan_num, $cpu_fan_rpm) = $_ =~ /(?|fan([\d+]):\s+([0-9]+)\s+rpm|cpu(\s)fan:\s+([0-9]+)\s+rpm)/i;
my ($cpu_volt) = $_ =~ /(?|in[\d+]\s*:\s+([\+\-0-9\.]+)\s+V|cpu\s+core\s+voltage\s*:\s+([0-9\.]+)\s+V)/i;
my ($cpu_fan_num, $cpu_fan_rpm) = $_ =~ /(?|fan([\d+])\s*:\s+([0-9]+)\s+rpm|cpu(\s)fan\s*:\s+([0-9]+)\s+rpm|cpu\s+fan\s*:\s+([0-9]+)\s+rpm)/i;
$cpu++ if ($cpu_volt || $cpu_fan_num);
# CPU package
@@ -519,8 +519,8 @@ if (&has_command("sensors")) {
# Common CPU multi
if (/Core\s+(\d+):\s+([\+\-][0-9\.]+)/) {
# Prioritise package core temperature
# data over motherboard but keep fans
# Prioritise package core temperature
# data over motherboard but keep fans
@cpu = (), $cpu_aux++
if ($cpu_aux & 1 && grep { $_->{'core'} eq $1 } @cpu);
push(@cpu,
@@ -567,7 +567,8 @@ if (&has_command("sensors")) {
}
# Approx from motherboard sensor as last resort
elsif (/(cputin|cpu\stemp):\s+([\+][0-9\.]+).*?[Cc]\s+.*?[=+].*?\)/i) {
elsif (/(cputin|cpu\s+temp)\s*:\s+([\+][0-9\.]+).*?[Cc]\s+.*?[=+].*?\)/i ||
/(cpu\s+temperature)\s*:\s+([\+][0-9\.]+).*?[Cc]/i) {
push(@cpu,
{ 'core' => 0,
'temp' => int($2)