Application DHCP Upgrade

This commit is contained in:
SourceDoctor
2020-05-22 23:02:19 +02:00
parent 5927983c50
commit cbe572f959
14 changed files with 423 additions and 22 deletions

View File

@@ -1279,6 +1279,7 @@ function get_postgres_databases($device_id)
function get_arrays_with_application($device, $app_id, $app_name, $category = null)
{
$entries = array();
$separator = '-';
if ($category) {
$pattern = sprintf('%s/%s-%s-%s-%s-*.rrd', get_rrd_dir($device['hostname']), 'app', $app_name, $app_id, $category);
@@ -1286,10 +1287,13 @@ function get_arrays_with_application($device, $app_id, $app_name, $category = nu
$pattern = sprintf('%s/%s-%s-%s-*.rrd', get_rrd_dir($device['hostname']), 'app', $app_name, $app_id);
}
# app_name contains a separator character? consider it
$offset = substr_count($app_name, $separator);
foreach (glob($pattern) as $rrd) {
$filename = basename($rrd, '.rrd');
list(,,, $entry) = explode("-", $filename, 4);
$entry = explode($separator, $filename, 4 + $offset)[3 + $offset];
if ($entry) {
array_push($entries, $entry);
@@ -1328,6 +1332,21 @@ function get_arrays_with_seafile($device, $app_id, $category)
return get_arrays_with_application($device, $app_id, $app_name, $category);
}
/**
* Get all dhcp data 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
* @param string $category which category of dhcp graphs are searched
* @return array list of dhcp data
*/
function get_arrays_with_dhcpstats($device, $app_id, $category)
{
$app_name = 'dhcp-stats';
return get_arrays_with_application($device, $app_id, $app_name, $category);
}
/**
* Get all mdadm arrays from the collected
* rrd files.