add mdadm support (#10159)

* add mdadm support

* Update mdadm.inc.php
This commit is contained in:
SourceDoctor
2019-05-13 06:42:03 +02:00
committed by Tony Murray
parent ef90da2a31
commit 96f7f142ba
12 changed files with 254 additions and 0 deletions

View File

@@ -1443,6 +1443,33 @@ function get_postgres_databases($device_id)
return array();
}
/**
* Get all mdadm arrays 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_arrays_with_mdadm($device, $app_id)
{
$arrays = array();
$pattern = sprintf('%s/%s-%s-%s-*.rrd', get_rrd_dir($device['hostname']), 'app', 'mdadm', $app_id);
foreach (glob($pattern) as $rrd) {
$filename = basename($rrd, '.rrd');
list(,,, $array_name) = explode("-", $filename, 4);
if ($array_name) {
array_push($arrays, $array_name);
}
}
return $arrays;
}
/**
* Get all disks (disk serial numbers) from the collected
* rrd files.