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
|
||||
*
|
||||
|
||||
@@ -12,10 +12,11 @@ $scale_min = 0;
|
||||
if (isset($vars['cert_name'])) {
|
||||
$cert_name_list = [$vars['cert_name']];
|
||||
} else {
|
||||
$cert_name_list = get_arrays_with_application($device, $app_id, $name);
|
||||
$cert_name_list = Rrd::getRrdApplicationArrays($device, $app_id, $name);
|
||||
}
|
||||
|
||||
$int = 0;
|
||||
$rrd_list = [];
|
||||
while (isset($cert_name_list[$int])) {
|
||||
$cert_name = $cert_name_list[$int];
|
||||
$rrd_filename = Rrd::name($device['hostname'], ['app', $name, $app_id, $cert_name]);
|
||||
|
||||
@@ -16,9 +16,10 @@ $printtotal = 0;
|
||||
$addarea = 1;
|
||||
$transparency = 15;
|
||||
|
||||
$arrays = get_arrays_with_application($device, $app_id, $name, $category);
|
||||
$arrays = Rrd::getRrdApplicationArrays($device, $app_id, $name, $category);
|
||||
|
||||
$int = 0;
|
||||
$rrd_list = [];
|
||||
while (isset($arrays[$int])) {
|
||||
$array = $arrays[$int];
|
||||
$rrd_filename = Rrd::name($device['hostname'], ['app', $name, $app_id, $array]);
|
||||
|
||||
@@ -16,9 +16,10 @@ $printtotal = 0;
|
||||
$addarea = 1;
|
||||
$transparency = 15;
|
||||
|
||||
$arrays = get_arrays_with_application($device, $app_id, $name, $category);
|
||||
$arrays = Rrd::getRrdApplicationArrays($device, $app_id, $name, $category);
|
||||
|
||||
$int = 0;
|
||||
$rrd_list = [];
|
||||
while (isset($arrays[$int])) {
|
||||
$array = $arrays[$int];
|
||||
$rrd_filename = Rrd::name($device['hostname'], ['app', $name, $app_id, $array]);
|
||||
|
||||
@@ -16,9 +16,10 @@ $printtotal = 0;
|
||||
$addarea = 1;
|
||||
$transparency = 15;
|
||||
|
||||
$arrays = get_arrays_with_application($device, $app_id, $name, $category);
|
||||
$arrays = Rrd::getRrdApplicationArrays($device, $app_id, $name, $category);
|
||||
|
||||
$int = 0;
|
||||
$rrd_list = [];
|
||||
while (isset($arrays[$int])) {
|
||||
$array = $arrays[$int];
|
||||
$rrd_filename = Rrd::name($device['hostname'], ['app', $name, $app_id, $array]);
|
||||
|
||||
@@ -16,9 +16,10 @@ $printtotal = 0;
|
||||
$addarea = 1;
|
||||
$transparency = 15;
|
||||
|
||||
$arrays = get_arrays_with_application($device, $app_id, $name, $category);
|
||||
$arrays = Rrd::getRrdApplicationArrays($device, $app_id, $name, $category);
|
||||
|
||||
$int = 0;
|
||||
$rrd_list = [];
|
||||
while (isset($arrays[$int])) {
|
||||
$array = $arrays[$int];
|
||||
$rrd_filename = Rrd::name($device['hostname'], ['app', $name, $app_id, $array]);
|
||||
|
||||
@@ -16,9 +16,10 @@ $printtotal = 0;
|
||||
$addarea = 1;
|
||||
$transparency = 15;
|
||||
|
||||
$arrays = get_arrays_with_application($device, $app_id, $name, $category);
|
||||
$arrays = Rrd::getRrdApplicationArrays($device, $app_id, $name, $category);
|
||||
|
||||
$int = 0;
|
||||
$rrd_list = [];
|
||||
while (isset($arrays[$int])) {
|
||||
$array = $arrays[$int];
|
||||
$rrd_filename = Rrd::name($device['hostname'], ['app', $name, $app_id, $array]);
|
||||
|
||||
@@ -16,9 +16,10 @@ $printtotal = 0;
|
||||
$addarea = 1;
|
||||
$transparency = 15;
|
||||
|
||||
$arrays = get_arrays_with_application($device, $app_id, $name, $category);
|
||||
$arrays = Rrd::getRrdApplicationArrays($device, $app_id, $name, $category);
|
||||
|
||||
$int = 0;
|
||||
$rrd_list = [];
|
||||
while (isset($arrays[$int])) {
|
||||
$array = $arrays[$int];
|
||||
$rrd_filename = Rrd::name($device['hostname'], ['app', $name, $app_id, $array]);
|
||||
|
||||
@@ -12,10 +12,11 @@ $scale_min = 0;
|
||||
if (isset($vars['array'])) {
|
||||
$arrays = [$vars['array']];
|
||||
} else {
|
||||
$arrays = get_arrays_with_application($device, $app_id, $name);
|
||||
$arrays = Rrd::getRrdApplicationArrays($device, $app_id, $name);
|
||||
}
|
||||
|
||||
$int = 0;
|
||||
$rrd_list = [];
|
||||
while (isset($arrays[$int])) {
|
||||
$array = $arrays[$int];
|
||||
$rrd_filename = Rrd::name($device['hostname'], ['app', $name, $app_id, $array]);
|
||||
|
||||
@@ -11,10 +11,11 @@ $transparency = 15;
|
||||
if (isset($vars['array'])) {
|
||||
$arrays = [$vars['array']];
|
||||
} else {
|
||||
$arrays = get_arrays_with_application($device, $app_id, $name, $category);
|
||||
$arrays = Rrd::getRrdApplicationArrays($device, $app_id, $name, $category);
|
||||
}
|
||||
|
||||
$int = 0;
|
||||
$rrd_list = [];
|
||||
while (isset($arrays[$int])) {
|
||||
$array = $arrays[$int];
|
||||
$rrd_filename = Rrd::name($device['hostname'], ['app', $name, $app_id, $array]);
|
||||
|
||||
@@ -12,12 +12,13 @@ $scale_min = 0;
|
||||
if (isset($vars['disk'])) {
|
||||
$disks = [$vars['disk']];
|
||||
} else {
|
||||
$disks = get_arrays_with_application($device, $app_id, $name);
|
||||
$disks = Rrd::getRrdApplicationArrays($device, $app_id, $name);
|
||||
}
|
||||
|
||||
$smart_enhancements = ['id9'];
|
||||
|
||||
$int = 0;
|
||||
$rrd_list = [];
|
||||
while (isset($disks[$int])) {
|
||||
$disk = $disks[$int];
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$domain_list = get_arrays_with_application($device, $app['app_id'], 'certificate');
|
||||
$domain_list = Rrd::getRrdApplicationArrays($device, $app['app_id'], 'certificate');
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$mdadm_arrays = get_arrays_with_application($device, $app['app_id'], 'mdadm');
|
||||
$mdadm_arrays = Rrd::getRrdApplicationArrays($device, $app['app_id'], 'mdadm');
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$disks = get_arrays_with_application($device, $app['app_id'], 'smart');
|
||||
$disks = Rrd::getRrdApplicationArrays($device, $app['app_id'], 'smart');
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user