Merge branch 'ent-6130-Errores-en-Custom-graph-Informes-de-metaconsola' into 'develop'

Fixed errors custom graph metaconsole

See merge request artica/pandorafms!3376
This commit is contained in:
Daniel Rodriguez 2020-07-13 13:13:29 +02:00
commit 1e31eae1a2
1 changed files with 32 additions and 64 deletions

View File

@ -1841,17 +1841,14 @@ function graphic_combined_module(
}
foreach ($module_list as $module_item) {
$automatic_custom_graph_meta = false;
if ($config['metaconsole']) {
if (is_metaconsole() === true) {
// Automatic custom graph from the report
// template in metaconsole.
if (is_array($module_list[$i])) {
$server = metaconsole_get_connection_by_id(
$module_item['server']
);
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
}
$module = $module_item['module'];
@ -1860,6 +1857,7 @@ function graphic_combined_module(
$temp[$module] = io_safe_output(
modules_get_agentmodule($module)
);
$query_last_value = sprintf(
'
SELECT datos
@ -1924,14 +1922,10 @@ function graphic_combined_module(
$temp[$module]['min'] = ($temp_min === false) ? 0 : $temp_min;
if ($config['metaconsole']) {
// Automatic custom graph from the
// report template in metaconsole.
if (is_array($module_list[0])) {
if (is_metaconsole() === true) {
metaconsole_restore_db();
}
}
}
$graph_values = $temp;
@ -1974,17 +1968,12 @@ function graphic_combined_module(
$i = 0;
$number_elements = count($module_list);
foreach ($module_list as $module_item) {
$automatic_custom_graph_meta = false;
if ($config['metaconsole']) {
// Automatic custom graph from
// the report template in metaconsole.
if (is_array($module_list[$i])) {
if (is_metaconsole() === true) {
$server = metaconsole_get_connection_by_id(
$module_item['server']
);
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
}
$module = $module_item['module'];
@ -2043,13 +2032,9 @@ function graphic_combined_module(
$temp[$module]['gauge'] = uniqid('gauge_');
if ($config['metaconsole']) {
// Automatic custom graph from the report
// template in metaconsole.
if (is_array($module_list[0])) {
if (is_metaconsole() === true) {
metaconsole_restore_db();
}
}
$i++;
}
@ -2096,17 +2081,12 @@ function graphic_combined_module(
case CUSTOM_GRAPH_VBARS:
$label = '';
foreach ($module_list as $module_item) {
$automatic_custom_graph_meta = false;
if (is_metaconsole() === true) {
// Automatic custom graph from the report
// template in metaconsole.
if (is_array($module_list[$i]) === true) {
$server = metaconsole_get_connection_by_id(
$module_item['server']
);
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
}
$module = $module_item['module'];
@ -2158,13 +2138,9 @@ function graphic_combined_module(
}
if (is_metaconsole() === true) {
// Automatic custom graph from the report
// template in metaconsole.
if (is_array($module_list[0]) === true) {
metaconsole_restore_db();
}
}
}
$color = color_graph_array();
@ -2232,17 +2208,12 @@ function graphic_combined_module(
case CUSTOM_GRAPH_PIE:
$total_modules = 0;
foreach ($module_list as $module_item) {
$automatic_custom_graph_meta = false;
if ($config['metaconsole']) {
// Automatic custom graph from the report
// template in metaconsole.
if (is_array($module_list[$i])) {
if (is_metaconsole() === true) {
$server = metaconsole_get_connection_by_id(
$module_item['server']
);
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
}
$module = $module_item['module'];
@ -2293,14 +2264,11 @@ function graphic_combined_module(
'value' => $value,
'unit' => $data_module['unit'],
];
if ($config['metaconsole']) {
// Automatic custom graph from the report
// template in metaconsole.
if (is_array($module_list[0])) {
if (is_metaconsole() === true) {
metaconsole_restore_db();
}
}
}
$temp['total_modules'] = $total_modules;