From 79c4367266110f1db2bd1e2911f0e5ecf349b50e Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Tue, 10 Apr 2012 16:41:46 +0000 Subject: [PATCH] 2012-04-10 Juan Manuel Ramon * godmode/reporting/graph_builder.graph_editor.php: Fixed display of agents in custom graphs editor when metaconsole is activated. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5929 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 +++ .../reporting/graph_builder.graph_editor.php | 36 ++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b7a65f70e8..1d09ffa7f9 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2012-04-10 Juan Manuel Ramon + + * godmode/reporting/graph_builder.graph_editor.php: Fixed display + of agents in custom graphs editor when metaconsole is activated. + 2012-04-10 Juan Manuel Ramon * godmode/groups/group_list.php diff --git a/pandora_console/godmode/reporting/graph_builder.graph_editor.php b/pandora_console/godmode/reporting/graph_builder.graph_editor.php index 63791f5132..e87fd9e03f 100644 --- a/pandora_console/godmode/reporting/graph_builder.graph_editor.php +++ b/pandora_console/godmode/reporting/graph_builder.graph_editor.php @@ -128,7 +128,41 @@ echo "".__('Agents').""; echo ""; echo "".__('Modules').""; echo ""; -echo "".html_print_select (agents_get_group_agents(), 'id_agents[]', 0, false, '', '', true, true, true, '', false, 'width:200px;').""; +// If metaconsole is activated +if ($config['metaconsole'] == 1) { + enterprise_include_once('include/functions_metaconsole.php'); + + $connection_names = enterprise_hook('metaconsole_get_connection_names'); + if ($connection_names === false) + $connection_names = array(); + + $agents_tmp = array(); + $agents = array(); + + foreach ($connection_names as $connection) { + $connection_data = enterprise_hook('metaconsole_get_connection', array($connection)); + + $connection_result = enterprise_hook('metaconsole_load_external_db', array($connection_data)); + + if ($connection_result) { + $agents_tmp = agents_get_group_agents (); + + if ($agents_tmp === false) + $agents_tmp = array(); + + foreach ($agents_tmp as $agent_key => $agent_name) { + $agents[$connection_data['server_name'] . '|' . $agent_key] = $agent_name; + } + } + + enterprise_hook('metaconsole_restore_db'); + } + + echo "".html_print_select ($agents, 'id_agents[]', 0, false, '', '', true, true, true, '', false, 'width:200px;').""; +} +else { + echo "".html_print_select (agents_get_group_agents(), 'id_agents[]', 0, false, '', '', true, true, true, '', false, 'width:200px;').""; +} echo "" . html_print_image("images/darrowright.png", true) . ""; echo "".html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;').""; echo "";