From 1d92575e36db5fd0b9bf2cc6a236dde32aba9239 Mon Sep 17 00:00:00 2001 From: jim-p Date: Tue, 5 Mar 2019 17:00:11 -0500 Subject: [PATCH] Update SMART status page with more detail/commands. Implements #9367 --- src/usr/local/www/diag_smart.php | 262 +++++++++++++------------------ 1 file changed, 105 insertions(+), 157 deletions(-) diff --git a/src/usr/local/www/diag_smart.php b/src/usr/local/www/diag_smart.php index 16b573d052..0dff2d966f 100644 --- a/src/usr/local/www/diag_smart.php +++ b/src/usr/local/www/diag_smart.php @@ -44,9 +44,34 @@ if ($action != 'config') { $smartctl = "/usr/local/sbin/smartctl"; -$valid_test_types = array("offline", "short", "long", "conveyance"); -$valid_info_types = array("i", "H", "c", "A", "a"); -$valid_log_types = array("error", "selftest"); +$test_types = array( + 'offline' => gettext('Offline Test'), + 'short' => gettext('Short Test'), + 'long' => gettext('Long Test'), + 'conveyance' => gettext('Conveyance Test') +); +$info_types = array( + 'x' => gettext('All SMART and Non-SMART Information'), + 'a' => gettext('All SMART Information'), + 'i' => gettext('Device Information'), + 'H' => gettext('Device Health'), + 'c' => gettext('SMART Capabilities'), + 'A' => gettext('SMART Attributes'), +); +$log_types = array( + 'error' => gettext('Summary Error Log'), + 'xerror' => gettext('Extended Error Log'), + 'selftest' => gettext('SMART Self-Test Log'), + 'xselftest' => gettext('Extended Self-Test Log'), + 'selective' => gettext('Selective Self-Test Log'), + 'directory' => gettext('Log Directory'), + 'scttemp' => gettext('Device Temperature Log (ATA Only)'), + 'devstat' => gettext('Device Statistics (ATA Only)'), + 'sataphy' => gettext('SATA PHY Events (SATA Only)'), + 'sasphy' => gettext('SAS PHY Events (SAS Only)'), + 'nvmelog' => gettext('NVMe Log (NVMe Only)'), + 'ssd' => gettext('SSD Device Statistics (ATA/SCSI)'), +); include("head.inc"); @@ -83,7 +108,7 @@ switch ($action) { case 'test': { $test = $_POST['testType']; - if (!in_array($test, $valid_test_types)) { + if (!in_array($test, array_keys($test_types))) { echo gettext("Invalid test type, bailing."); return; } @@ -101,7 +126,7 @@ switch ($action) {