mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 08:40:24 +00:00
Add AMD Ryzen temperature based on "die" of the CPU
https://sourceforge.net/p/webadmin/discussion/600155/thread/a9d8fe19c0/?limit=25
This commit is contained in:
@@ -500,6 +500,7 @@ if (&has_command("sensors")) {
|
||||
my $fh = "SENSORS";
|
||||
my $aa;
|
||||
my $ab;
|
||||
my $ac;
|
||||
&open_execute_command($fh, "sensors </dev/null 2>/dev/null", 1);
|
||||
while(<$fh>) {
|
||||
if (/Core\s+(\d+):\s+([\+\-][0-9\.]+)/) {
|
||||
@@ -522,7 +523,7 @@ if (&has_command("sensors")) {
|
||||
if ($aa && /temp(\d+):\s+([\+\-][0-9\.]+)\s+.*?[=+].*?\)/) {
|
||||
# Adjust to start from `0` as all other outputs
|
||||
push(@rvx, { 'core' => (int($1) - 1),
|
||||
'temp' => $2 });
|
||||
'temp' => $2 });
|
||||
}
|
||||
|
||||
# New line - new device
|
||||
@@ -531,10 +532,20 @@ if (&has_command("sensors")) {
|
||||
$ab = 1 if (/cpu_thermal-virtual-[\d]+/i);
|
||||
# Get odd output like in #1280
|
||||
if ($ab && /temp(\d+):\s+([\+\-][0-9\.]+)/) {
|
||||
push(@rvx, { 'core' => $1,
|
||||
'temp' => $2 });
|
||||
}
|
||||
push(@rvx, { 'core' => $1,
|
||||
'temp' => $2 });
|
||||
}
|
||||
|
||||
# AMD Ryzen oddness
|
||||
$ac = 0 if (/^\s*$/);
|
||||
# Check for CPU
|
||||
$ac = 1 if (/[\d]+temp-pci/i);
|
||||
# Get odd output like in #discussion/600155
|
||||
if ($ac && /Tdie:\s+([\+\-][0-9\.]+)/) {
|
||||
push(@rvx, { 'core' => 0,
|
||||
'temp' => $1 });
|
||||
}
|
||||
}
|
||||
}
|
||||
close($fh);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user