Fixed bug in auto combined graph

This commit is contained in:
Tatiana Llorente 2020-01-08 11:37:44 +01:00
parent 64e63dad63
commit 2c019f04ee
2 changed files with 36 additions and 12 deletions

View File

@ -1446,9 +1446,20 @@ function graphic_combined_module(
$data_module_graph['agent_name'] = modules_get_agentmodule_agent_name( $data_module_graph['agent_name'] = modules_get_agentmodule_agent_name(
$agent_module_id $agent_module_id
); );
$data_module_graph['agent_alias'] = modules_get_agentmodule_agent_alias(
$agent_module_id if (is_metaconsole()) {
); $data_module_graph['agent_alias'] = db_get_value(
'alias',
'tagente',
'id_agente',
(int) $module_data['id_agente']
);
} else {
$data_module_graph['agent_alias'] = modules_get_agentmodule_agent_alias(
$agent_module_id
);
}
$data_module_graph['agent_id'] = $module_data['id_agente']; $data_module_graph['agent_id'] = $module_data['id_agente'];
$data_module_graph['module_name'] = $module_data['nombre']; $data_module_graph['module_name'] = $module_data['nombre'];
$data_module_graph['id_module_type'] = $module_data['id_tipo_modulo']; $data_module_graph['id_module_type'] = $module_data['id_tipo_modulo'];

View File

@ -325,6 +325,17 @@ function reporting_make_reporting_data(
$content['id_agent'] $content['id_agent']
); );
// This is for metaconsole. It is an array with modules and server (id node).
if (is_array($content['id_agent_module'])) {
$modules_server_array = $content['id_agent_module'];
$modules_array = [];
foreach ($modules_server_array as $value) {
$modules_array[] = $value['module'];
}
$content['id_agent_module'] = $modules_array;
}
$modules = agents_get_modules( $modules = agents_get_modules(
$agent_value, $agent_value,
[ [
@ -7599,16 +7610,18 @@ function reporting_custom_graph(
$content['name'] = __('Simple graph'); $content['name'] = __('Simple graph');
} }
$module_source = db_get_all_rows_sql( if ($type_report != 'automatic_graph') {
'SELECT id_agent_module $module_source = db_get_all_rows_sql(
FROM tgraph_source 'SELECT id_agent_module
WHERE id_graph = '.$content['id_gs'] FROM tgraph_source
); WHERE id_graph = '.$content['id_gs']
);
if (isset($module_source) && is_array($module_source)) { if (isset($module_source) && is_array($module_source)) {
$modules = []; $modules = [];
foreach ($module_source as $key => $value) { foreach ($module_source as $key => $value) {
$modules[$key] = $value['id_agent_module']; $modules[$key] = $value['id_agent_module'];
}
} }
} }