From: <abe...@us...> - 2014-10-28 17:30:26
|
Revision: 6787 http://sourceforge.net/p/astlinux/code/6787 Author: abelbeck Date: 2014-10-28 17:30:17 +0000 (Tue, 28 Oct 2014) Log Message: ----------- web interface, Status tab, added "S.M.A.R.T Monitoring", disabled by default and can be enabled via the Prefs tab Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/common/license-packages.txt branches/1.0/package/webinterface/altweb/common/status.inc Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2014-10-28 15:48:57 UTC (rev 6786) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2014-10-28 17:30:17 UTC (rev 6787) @@ -146,6 +146,10 @@ $value = 'status_show_hardware_monitoring = yes'; fwrite($fp, $value."\n"); } + if (isset($_POST['smart_monitoring'])) { + $value = 'status_show_smart_monitoring = yes'; + fwrite($fp, $value."\n"); + } if (! isset($_POST['system_logs'])) { $value = 'status_show_system_logs = no'; fwrite($fp, $value."\n"); @@ -659,6 +663,9 @@ putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'status_show_hardware_monitoring') === 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="hardware_monitoring" name="hardware_monitoring"'.$sel.' /></td><td colspan="5">Show Hardware Monitoring</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'status_show_smart_monitoring') === 'yes') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="smart_monitoring" name="smart_monitoring"'.$sel.' /></td><td colspan="5">Show S.M.A.R.T Monitoring</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'status_show_system_logs') !== 'no') ? ' checked="checked"' : ''; Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2014-10-28 15:48:57 UTC (rev 6786) +++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2014-10-28 17:30:17 UTC (rev 6787) @@ -51,3 +51,4 @@ dnscrypt-proxy~Copyright (c) 2011-2014 Frank Denis libsodium~Copyright (c) 2013-2014 Frank Denis phoneprov-tools~Copyright (c) 2014 Lonnie Abelbeck and Michael Keuter. +smartmontools~Copyright (c) 2002-2014, Bruce Allen, Christian Franke, et al. Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2014-10-28 15:48:57 UTC (rev 6786) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2014-10-28 17:30:17 UTC (rev 6787) @@ -1212,21 +1212,35 @@ if (getPREFdef($global_prefs, 'status_show_hardware_monitoring') === 'yes') { putHtml("<h2>Hardware Monitoring:</h2>"); putHtml("<pre>"); - $tmpfile = tempnam("/tmp", "PHP_"); - shell('/usr/bin/sensors >'.$tmpfile, $status); - - $ph = @fopen($tmpfile, "r"); - while (! feof($ph)) { - if ($line = rtrim(fgets($ph, 1024))) { + + $output = array(); + @exec('/usr/bin/sensors', $output); + foreach ($output as $line) { + $line = rtrim($line); + if ($line !== '') { putText($line); } } - fclose($ph); - @unlink($tmpfile); + unset($output); putHtml("</pre>"); } } +if (is_executable('/usr/sbin/smart-status')) { + if (getPREFdef($global_prefs, 'status_show_smart_monitoring') === 'yes') { + putHtml("<h2>S.M.A.R.T Monitoring:</h2>"); + putHtml("<pre>"); + + $output = array(); + @exec('/usr/sbin/smart-status attributes', $output); + foreach ($output as $line) { + putText(rtrim($line)); + } + unset($output); + putHtml("</pre>"); + } +} + if ($daemon['syslogd'] > 0) { if (getPREFdef($global_prefs, 'status_show_system_logs') !== 'no') { putHtml("<h2>Latest System Logs:</h2>"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |