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;
}