mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Make applications work with rrdcached (#12807)
This commit is contained in:
@@ -1115,42 +1115,6 @@ function get_postgres_databases($device_id)
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all application 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 graphs are searched
|
||||
* @return array list of entry data
|
||||
*/
|
||||
function get_arrays_with_application($device, $app_id, $app_name, $category = null)
|
||||
{
|
||||
$entries = [];
|
||||
$separator = '-';
|
||||
|
||||
if ($category) {
|
||||
$pattern = sprintf('%s/%s-%s-%s-%s-*.rrd', Rrd::dirFromHost($device['hostname']), 'app', $app_name, $app_id, $category);
|
||||
} else {
|
||||
$pattern = sprintf('%s/%s-%s-%s-*.rrd', Rrd::dirFromHost($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');
|
||||
|
||||
$entry = explode($separator, $filename, 4 + $offset)[3 + $offset];
|
||||
|
||||
if ($entry) {
|
||||
array_push($entries, $entry);
|
||||
}
|
||||
}
|
||||
|
||||
return $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return stacked graphs information
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user