mirror of
https://github.com/unraid/webgui.git
synced 2026-01-17 23:20:02 -06:00
Merge pull request #209 from bergware/6.4-wip
Revised SMART temperature reading logic
This commit is contained in:
@@ -139,7 +139,7 @@ case 'disk':
|
||||
$smart = "state/smart/$name";
|
||||
$state = exec("hdparm -C ".escapeshellarg("/dev/$port")."|grep -Po 'active|unknown'") ? 'blue-on' : 'blue-blink';
|
||||
if ($state=='blue-on') my_smart($row7[$n],$name,'New');
|
||||
$temp = file_exists($smart) ? exec("awk 'BEGIN{t=\"*\"}\$1==194{t=\$10;exit};\$1==190{t=100-\$10;exit};\$1==\"Temperature:\"{t=\$2;exit} END{print t}' ".escapeshellarg($smart)) : '*';
|
||||
$temp = file_exists($smart) ? exec("awk 'BEGIN{s=t=\"*\"}\$1==190{s=\$10};\$1==194{t=\$10;exit};\$1==\"Temperature:\"{t=\$2;exit} END{if(t!=\"*\")print t; else print s}' ".escapeshellarg($smart)) : '*';
|
||||
$heat = exceed($temp,$max,$top) ? 'max' : (exceed($temp,$hot,$top) ? 'hot' : '');
|
||||
if ($heat)
|
||||
my_insert($row6[$n],"<span class='heat-img'><img src='$path/$heat.png'></span><span class='heat-text' style='display:none'>".my_temp($temp,$_POST['unit'])."</span>");
|
||||
|
||||
@@ -271,7 +271,7 @@ function read_disk($name, $part) {
|
||||
$smart = "/var/local/emhttp/smart/$name";
|
||||
$type = $var['smType'] ?? '';
|
||||
if (!file_exists($smart) || (time()-filemtime($smart)>=$var['poll_attributes'])) exec("smartctl -n standby -A $type ".escapeshellarg("/dev/$port")." >".escapeshellarg($smart)." &");
|
||||
return exec("awk 'BEGIN{t=\"*\"}\$1==194{t=\$10;exit};\$1==190{t=100-\$10;exit};\$1==\"Temperature:\"{t=\$2;exit} END{print t}' ".escapeshellarg($smart)." 2>/dev/null");
|
||||
return exec("awk 'BEGIN{s=t=\"*\"}\$1==190{s=\$10};\$1==194{t=\$10;exit};\$1==\"Temperature:\"{t=\$2;exit} END{if(t!=\"*\")print t; else print s}' ".escapeshellarg($smart)." 2>/dev/null");
|
||||
}
|
||||
}
|
||||
function show_totals($text) {
|
||||
|
||||
@@ -256,7 +256,7 @@ foreach ($devs as $dev) {
|
||||
$type = $var['smType'] ?? '';
|
||||
$port = port_name($name);
|
||||
if (!file_exists($smart) || (time()-filectime($smart)>$var['poll_attributes'])) exec("smartctl -n standby -A $type ".escapeshellarg("/dev/$port")." >".escapeshellarg($smart));
|
||||
$temp = exec("awk 'BEGIN{t=\"*\"} \$1==190||\$1==194{t=\$10;exit};\$1==\"Temperature:\"{t=\$2;exit} END{print t}' ".escapeshellarg($smart)." 2>/dev/null");
|
||||
$temp = exec("awk 'BEGIN{s=t=\"*\"}\$1==190{s=\$10};\$1==194{t=\$10;exit};\$1==\"Temperature:\"{t=\$2;exit} END{if(t!=\"*\")print t; else print s}' ".escapeshellarg($smart)." 2>/dev/null");
|
||||
$text = "device $name";
|
||||
$info = !empty($dev['id']) ? "{$dev['id']} ($name)": "No device identification ($name)";
|
||||
// process disk temperature notifications
|
||||
|
||||
Reference in New Issue
Block a user