Seperate reading of attributes 190 or 194 temperatures (194=T, 190=100-T)

This commit is contained in:
bergware
2017-11-17 17:59:25 +01:00
parent ba0d06c71f
commit 78437e5ac0
2 changed files with 2 additions and 2 deletions

View File

@@ -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||\$1==190{t=\$10;exit};\$1==\"Temperature:\"{t=\$2;exit} END{print t}' ".escapeshellarg($smart)) : '*';
$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)) : '*';
$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>");

View File

@@ -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||\$1==190{t=\$10;exit};\$1==\"Temperature:\"{t=\$2;exit} END{print t}' ".escapeshellarg($smart)." 2>/dev/null");
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");
}
}
function show_totals($text) {