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,12 +1922,8 @@ 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 metaconsole_restore_db();
// report template in metaconsole.
if (is_array($module_list[0])) {
metaconsole_restore_db();
}
} }
} }
@ -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']) { $server = metaconsole_get_connection_by_id(
// Automatic custom graph from $module_item['server']
// the report template in metaconsole. );
if (is_array($module_list[$i])) {
$server = metaconsole_get_connection_by_id( metaconsole_connect($server);
$module_item['server']
);
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
} }
$module = $module_item['module']; $module = $module_item['module'];
@ -2043,12 +2032,8 @@ 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 metaconsole_restore_db();
// template in metaconsole.
if (is_array($module_list[0])) {
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 $server = metaconsole_get_connection_by_id(
// template in metaconsole. $module_item['server']
if (is_array($module_list[$i]) === true) { );
$server = metaconsole_get_connection_by_id(
$module_item['server'] metaconsole_connect($server);
);
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
} }
$module = $module_item['module']; $module = $module_item['module'];
@ -2158,11 +2138,7 @@ function graphic_combined_module(
} }
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
// Automatic custom graph from the report metaconsole_restore_db();
// template in metaconsole.
if (is_array($module_list[0]) === true) {
metaconsole_restore_db();
}
} }
} }
@ -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']) { $server = metaconsole_get_connection_by_id(
// Automatic custom graph from the report $module_item['server']
// template in metaconsole. );
if (is_array($module_list[$i])) {
$server = metaconsole_get_connection_by_id( metaconsole_connect($server);
$module_item['server']
);
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
} }
$module = $module_item['module']; $module = $module_item['module'];
@ -2293,12 +2264,9 @@ 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. metaconsole_restore_db();
if (is_array($module_list[0])) {
metaconsole_restore_db();
}
} }
} }