Merge pull request #11661 from SourceDoctor/app_dhcp_enhancement

Application DHCP Upgrade
This commit is contained in:
Tony Murray
2020-06-16 17:03:45 -05:00
committed by GitHub
14 changed files with 412 additions and 27 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);