diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 88076b1a5b..3262131063 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2011-05-05 Sergio Martin + + * godmode/agentes/configurar_agente.php + godmode/agentes/module_manager_editor.php: Added the feature of + edit the modules from the agent config or create a module from + a local component or manually + 2011-05-05 Miguel de Dios * pandoradb.sql, pandoradb.postgreSQL.sql, extras/pandoradb_migrate_v3.2_to_v4.0.sql: changed the default value for diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 3ed842fb18..0528a25d21 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -129,7 +129,6 @@ if ($create_agent) { $cascade_protection = (int) get_parameter_post ("cascade_protection", 0); $icon_path = (string) get_parameter_post ("icon_path",''); $update_gis_data = (int) get_parameter_post("update_gis_data", 0); - $fields = db_get_all_fields_in_table('tagent_custom_fields'); if($fields === false) $fields = array(); @@ -560,6 +559,8 @@ if ($update_module || $create_module) { $tcp_send = (string) get_parameter ('tcp_send'); $tcp_rcv = (string) get_parameter ('tcp_rcv'); $tcp_port = (int) get_parameter ('tcp_port'); + $configuration_data = (string) get_parameter ('configuration_data'); + $old_configuration_data = (string) get_parameter ('old_configuration_data'); $custom_string_1 = (string) get_parameter ('custom_string_1'); $custom_string_2 = (string) get_parameter ('custom_string_2'); @@ -616,6 +617,10 @@ if ($update_module || $create_module) { if ($active_snmp_v3) { // } + + // Make changes in the conf file if necessary + enterprise_include_once('include/functions_config_agents.php'); + enterprise_hook('write_module_in_conf', array($id_agente, safe_output($old_configuration_data), safe_output($configuration_data))); } // MODULE UPDATE @@ -906,20 +911,17 @@ if ($updateGIS) { // ----------------------------------- // Load page depending on tab selected // ----------------------------------- - switch ($tab) { case "main": require ("agent_manager.php"); break; case "module": - if ($id_agent_module || $edit_module) { require ("module_manager_editor.php"); } else { require ("module_manager.php"); } - break; case "alert": /* Because $id_agente is set, it will show only agent alerts */ diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index 62186e2e0e..32c1078931 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -246,12 +246,22 @@ switch ($moduletype) { case "dataserver": case 1: $moduletype = 1; + // Has remote configuration ? + $agent_md5 = md5 (get_agent_name($id_agente), false); + $remote_conf = file_exists ($config["remote_config"]."/md5/".$agent_md5.".md5"); /* Categories is an array containing the allowed module types (generic_data, generic_string, etc) from ttipo_modulo (field categoria) */ $categories = array (0, 1, 2, 6, 7, 8, -1); require ('module_manager_editor_common.php'); require ('module_manager_editor_data.php'); + if ($config['enterprise_installed'] && $remote_conf) { + if($id_agent_module) { + enterprise_include_once('include/functions_config_agents.php'); + $configuration_data = enterprise_hook('get_module_from_conf', array($id_agente, get_agentmodule_name($id_agent_module))); + } + enterprise_include ('godmode/agentes/module_manager_editor_data.php'); + } break; case "networkserver": case 2: