webui: S.M.A.R.T visualization improvements (#8310)

* Increase description length in graphs
* Add SMART attr177, previously recorded, but not displayed
* Change the multi-graph titles to better reflect their content
* Change SMART attr numbers to a more human-friendly description
* Minor text corrections
This commit is contained in:
endofline
2018-03-13 15:26:23 +02:00
committed by Neil Lathwood
parent 4e94e9905c
commit b70ff543bf
23 changed files with 106 additions and 84 deletions

View File

@@ -1578,20 +1578,30 @@ function get_postgres_databases($device_id)
return array();
}
// takes the device array and app_id
/**
* Get all disks (disk serial numbers) from the collected
* rrd files.
*
* @param array $device device for which we get the rrd's
* @param int $app_id application id on the device
* @return array list of disks
*/
function get_disks_with_smart($device, $app_id)
{
$all_disks = get_disks($device['device_id']);
$disks = array();
$all_disks_int = 0;
while (isset($all_disks[$all_disks_int])) {
$disk = $all_disks[$all_disks_int]['diskio_descr'];
$rrd_filename = rrd_name($device['hostname'], array('app', 'smart', $app_id, $disk));
if (rrdtool_check_rrd_exists($rrd_filename)) {
$disks[] = $disk;
$pattern = sprintf('%s/%s-%s-%s-*.rrd', get_rrd_dir($device['hostname']), 'app', 'smart', $app_id);
foreach (glob($pattern) as $rrd) {
$filename = basename($rrd, '.rrd');
list(,,, $disk) = explode("-", $filename);
if ($disk) {
array_push($disks, $disk);
}
$all_disks_int++;
}
return $disks;
}

View File

@@ -3,8 +3,8 @@ $name = 'smart';
$app_id = $app['app_id'];
$unit_text = '';
$unitlen = 10;
$bigdescrlen = 10;
$smalldescrlen = 10;
$bigdescrlen = 25;
$smalldescrlen = 25;
$colours = 'mega';
$dostack = 0;
$printtotal = 0;
@@ -16,27 +16,27 @@ $rrd_filename = rrd_name($device['hostname'], array('app', $name, $app_id, $vars
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'ID# 5',
'descr' => 'Reallocated_Sector_Ct',
'ds' => 'id5',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'ID# 187',
'descr' => 'Reported_Uncorrect',
'ds' => 'id187',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'ID# 188',
'descr' => 'Command_Timeout',
'ds' => 'id188',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'ID# 197',
'descr' => 'Current_Pending_Sector',
'ds' => 'id197',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'ID# 198',
'descr' => 'Offline_Uncorrectable',
'ds' => 'id198',
);
}

View File

@@ -1,8 +1,8 @@
<?php
$unit_text = 'Spin Retry Cnt';
$unitlen = 20;
$bigdescrlen = 5;
$smalldescrlen = 5;
$bigdescrlen = 15;
$smalldescrlen = 15;
$rrdVar='id10';

View File

@@ -1,8 +1,8 @@
<?php
$unit_text = 'SSD Wear Lvl';
$unit_text = 'SSD Wear Lvl Worst Erase Cnt';
$unitlen = 20;
$bigdescrlen = 5;
$smalldescrlen = 5;
$bigdescrlen = 15;
$smalldescrlen = 15;
$rrdVar='id173';

View File

@@ -0,0 +1,9 @@
<?php
$unit_text = 'SSD Wear Lvl';
$unitlen = 20;
$bigdescrlen = 15;
$smalldescrlen = 15;
$rrdVar='id177';
require 'smart-common.inc.php';

View File

@@ -1,8 +1,8 @@
<?php
$unit_text = 'Dctcd Uncor Bad';
$unitlen = 20;
$bigdescrlen = 5;
$smalldescrlen = 5;
$bigdescrlen = 15;
$smalldescrlen = 15;
$rrdVar='id183';

View File

@@ -1,8 +1,8 @@
<?php
$unit_text = 'End-to-End err';
$unitlen = 20;
$bigdescrlen = 5;
$smalldescrlen = 5;
$bigdescrlen = 15;
$smalldescrlen = 15;
$rrdVar='id184';

View File

@@ -1,8 +1,8 @@
<?php
$unit_text = 'Rprtd Uncr Err';
$unitlen = 20;
$bigdescrlen = 5;
$smalldescrlen = 5;
$bigdescrlen = 15;
$smalldescrlen = 15;
$rrdVar='id187';

View File

@@ -1,8 +1,8 @@
<?php
$unit_text = 'Cmd Timeout';
$unitlen = 20;
$bigdescrlen = 5;
$smalldescrlen = 5;
$bigdescrlen = 15;
$smalldescrlen = 15;
$rrdVar='id188';

View File

@@ -1,8 +1,8 @@
<?php
$unit_text = 'Air Temp (C)';
$unitlen = 12;
$bigdescrlen = 12;
$smalldescrlen = 12;
$bigdescrlen = 15;
$smalldescrlen = 15;
$rrdVar='id190';

View File

@@ -1,8 +1,8 @@
<?php
$unit_text = 'Temp (C)';
$unitlen = 10;
$bigdescrlen = 10;
$smalldescrlen = 10;
$bigdescrlen = 15;
$smalldescrlen = 15;
$rrdVar='id194';

View File

@@ -1,8 +1,8 @@
<?php
$unit_text = 'Reall Evnt Cnt';
$unitlen = 20;
$bigdescrlen = 5;
$smalldescrlen = 5;
$bigdescrlen = 15;
$smalldescrlen = 15;
$rrdVar='id196';

View File

@@ -1,8 +1,8 @@
<?php
$unit_text = 'Crnt Pnd Sct Cnt';
$unitlen = 20;
$bigdescrlen = 5;
$smalldescrlen = 5;
$bigdescrlen = 15;
$smalldescrlen = 15;
$rrdVar='id197';

View File

@@ -1,8 +1,8 @@
<?php
$unit_text = 'Uncr Sct Cnt';
$unitlen = 20;
$bigdescrlen = 5;
$smalldescrlen = 5;
$bigdescrlen = 15;
$smalldescrlen = 15;
$rrdVar='id198';

View File

@@ -1,8 +1,8 @@
<?php
$unit_text = 'CRC Err Cnt';
$unitlen = 20;
$bigdescrlen = 5;
$smalldescrlen = 5;
$bigdescrlen = 15;
$smalldescrlen = 15;
$rrdVar='id199';

View File

@@ -1,8 +1,8 @@
<?php
$unit_text = 'SDD Life Left';
$unitlen = 20;
$bigdescrlen = 5;
$smalldescrlen = 5;
$bigdescrlen = 15;
$smalldescrlen = 15;
$rrdVar='id231';

View File

@@ -1,8 +1,8 @@
<?php
$unit_text = 'Media Wear Indi';
$unitlen = 20;
$bigdescrlen = 5;
$smalldescrlen = 5;
$bigdescrlen = 15;
$smalldescrlen = 15;
$rrdVar='id233';

View File

@@ -1,8 +1,8 @@
<?php
$unit_text = 'Reall Sect Ct';
$unitlen = 20;
$bigdescrlen = 5;
$smalldescrlen = 5;
$bigdescrlen = 15;
$smalldescrlen = 15;
$rrdVar='id5';

View File

@@ -3,8 +3,8 @@ $name = 'smart';
$app_id = $app['app_id'];
$unit_text = '';
$unitlen = 10;
$bigdescrlen = 10;
$smalldescrlen = 10;
$bigdescrlen = 25;
$smalldescrlen = 25;
$colours = 'mega';
$dostack = 0;
$printtotal = 0;
@@ -16,27 +16,27 @@ $rrd_filename = rrd_name($device['hostname'], array('app', $name, $app_id, $vars
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'ID# 10',
'descr' => 'Spin_Retry_Count',
'ds' => 'id10',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'ID# 183',
'descr' => 'Runtime_Bad_Block',
'ds' => 'id183',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'ID# 184',
'descr' => 'End-to-End_Error',
'ds' => 'id184',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'ID# 196',
'descr' => 'Reallocated_Event_Count',
'ds' => 'id197',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'ID# 199',
'descr' => 'UDMA_CRC_Error_Count',
'ds' => 'id199',
);
}

View File

@@ -3,8 +3,8 @@ $name = 'smart';
$app_id = $app['app_id'];
$unit_text = '';
$unitlen = 10;
$bigdescrlen = 10;
$smalldescrlen = 10;
$bigdescrlen = 25;
$smalldescrlen = 25;
$colours = 'mega';
$dostack = 0;
$printtotal = 0;
@@ -16,17 +16,22 @@ $rrd_filename = rrd_name($device['hostname'], array('app', $name, $app_id, $vars
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'ID# 173',
'descr' => 'Worst_Case_Erase_Count',
'ds' => 'id173',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'ID# 231',
'descr' => 'Wear_Leveling_Count',
'ds' => 'id177',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'SSD_Life_Left',
'ds' => 'id231',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'ID# 233',
'descr' => 'Media_Wearout_Indicator',
'ds' => 'id233',
);
}

View File

@@ -3,8 +3,8 @@ $name = 'smart';
$app_id = $app['app_id'];
$unit_text = '';
$unitlen = 10;
$bigdescrlen = 10;
$smalldescrlen = 10;
$bigdescrlen = 25;
$smalldescrlen = 25;
$colours = 'mega';
$dostack = 0;
$printtotal = 0;
@@ -16,12 +16,12 @@ $rrd_filename = rrd_name($device['hostname'], array('app', $name, $app_id, $vars
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'ID# 194',
'descr' => 'Temperature_Celsius',
'ds' => 'id194',
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'ID# 190',
'descr' => 'Airflow_Temperature_Cel',
'ds' => 'id190',
);
}

View File

@@ -3,8 +3,8 @@ $name = 'smart';
$app_id = $app['app_id'];
$unit_text = '';
$unitlen = 20;
$bigdescrlen = 10;
$smalldescrlen = 10;
$bigdescrlen = 15;
$smalldescrlen = 15;
$colours = 'mega';
$dostack = 0;
$printtotal = 0;

View File

@@ -13,40 +13,38 @@ $link_array = array(
'app' => 'smart',
);
echo generate_link('All Disks', $link_array);
echo '| disks:';
$drives = array();
$disks_int=0;
while (isset($disks[$disks_int])) {
$disk=$disks[$disks_int];
$label=$disk;
foreach ($disks as $label) {
$disk = $label;
if ($vars['disk'] == $disk) {
$label='>>'.$disk.'<<';
$label = sprintf('⚫ %s', $label);
}
echo generate_link($label, $link_array, array('disk'=>$disk)).', ';
$disks_int++;
array_push($drives, generate_link($label, $link_array, array('disk'=>$disk)));
}
printf("%s | drives: %s", generate_link('All Drives', $link_array), implode(', ', $drives));
print_optionbar_end();
if (isset($vars['disk'])) {
$graphs = array(
'smart_big5'=>'Big 5: Reallocated Sector Count(5), Reported Uncorrectable Errors(187), Command Timeout(188), Current Pending Sector Count(197), Offline Uncorrectable(198)',
'smart_temp'=>'Temperature(C)(190), Air Temperature(C)(194)',
'smart_ssd'=>'SSD: Wear Leveling Count(173), SSD Life Left(231), Media Wearout Indicator(233)',
'smart_other'=>'Other: Spin Retry Count(10), Detected Uncorrentable Bad Blocks(183), End-to-End error(184), Reallocation Event Count(196), UltraDMA CRC Error Count(199)',
'smart_tests_status'=>'Tallies various selftest statuses',
'smart_tests_ran'=>'Tallies various selftest types',
'smart_big5' => 'Reliability / Age',
'smart_temp' => 'Temperature',
'smart_ssd' => 'SSD-specific',
'smart_other' => 'Other',
'smart_tests_status'=> 'S.M.A.R.T self-tests results',
'smart_tests_ran' => 'S.M.A.R.T self-tests run count',
);
} else {
$graphs = array(
'smart_id5'=>'ID# 5, Reallocated Sectors Count',
'smart_id10'=>'ID# 10, Spin Retry Count',
'smart_id173'=>'ID# 173 SSD Wear Leveling Count',
'smart_id183'=>'ID# 183, Detected Uncorrentable Bad Blocks',
'smart_id173'=>'ID# 173, SSD Wear Leveller Worst Case Erase Count',
'smart_id177'=>'ID# 177, SSD Wear Leveling Count',
'smart_id183'=>'ID# 183, Detected Uncorrectable Bad Blocks',
'smart_id184'=>'ID# 184, End-to-End error / IOEDC',
'smart_id187'=>'ID# 187, Reported Uncorrectable Errors',
'smart_id188'=>'ID# 188, Command Timeout',
@@ -54,7 +52,7 @@ if (isset($vars['disk'])) {
'smart_id194'=>'ID# 194, Temperature (C)',
'smart_id196'=>'ID# 196, Reallocation Event Count',
'smart_id197'=>'ID# 197, Current Pending Sector Count',
'smart_id198'=>'ID# 198, Uncorrectable Sector Count or Offline Uncorrectable or Off-Line Scan Uncorrectable Sector Count',
'smart_id198'=>'ID# 198, Uncorrectable Sector Count / Offline Uncorrectable / Off-Line Scan Uncorrectable Sector Count',
'smart_id199'=>'ID# 199, UltraDMA CRC Error Count',
'smart_id231'=>'ID# 231, SSD Life Left',
'smart_id233'=>'ID# 233, Media Wearout Indicator'