Fixed errors custom graph metaconsole

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