diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 096f74769f..2b58f05a7b 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,19 @@ +2013-10-16 Miguel de Dios + + * godmode/massive/massive_delete_modules.php, + include/functions_modules.php: fixed the delete modules with + conf from the massive operations. + +2013-10-16 Miguel de Dios + + * pandoradb_data.sql, + extensions/update_manager/sql/update_manager.sql, + extensions/update_manager/sql/update_manager.postgreSQL.sql, + extensions/update_manager/sql/update_manager.oracle.sql, + extensions/system_info.php, pandoradb.data.postgreSQL.sql, + pandoradb.data.oracle.sql, extras/pandora_diag.php: removed the + unused path to keygen. + 2013-10-16 Sergio Martin * ChangeLog: Commit last commit missed ChangeLog diff --git a/pandora_console/extensions/system_info.php b/pandora_console/extensions/system_info.php index 008fda5186..9a12ae1c72 100644 --- a/pandora_console/extensions/system_info.php +++ b/pandora_console/extensions/system_info.php @@ -52,7 +52,6 @@ function getPandoraDiagnostic(&$systemInfo) { $systemInfo['db_maintance'] = date ("Y/m/d H:i:s", db_get_sql ("SELECT `value` FROM tconfig WHERE `token` = 'db_maintance'")); $systemInfo['customer_key'] = db_get_sql("SELECT value FROM tupdate_settings WHERE `key` = 'customer_key';"); $systemInfo['updating_code_path'] = db_get_sql("SELECT value FROM tupdate_settings WHERE `key` = 'updating_code_path'"); - $systemInfo['keygen_path'] = db_get_sql("SELECT value FROM tupdate_settings WHERE `key` = 'keygen_path'"); $systemInfo['current_update'] = db_get_sql("SELECT value FROM tupdate_settings WHERE `key` = 'current_update'"); break; case "postgresql": @@ -62,7 +61,6 @@ function getPandoraDiagnostic(&$systemInfo) { $systemInfo['db_maintance'] = date ("Y/m/d H:i:s", db_get_sql ("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_maintance'")); $systemInfo['customer_key'] = db_get_sql("SELECT value FROM tupdate_settings WHERE \"key\" = 'customer_key';"); $systemInfo['updating_code_path'] = db_get_sql("SELECT value FROM tupdate_settings WHERE \"key\" = 'updating_code_path'"); - $systemInfo['keygen_path'] = db_get_sql("SELECT value FROM tupdate_settings WHERE \"key\" = 'keygen_path'"); $systemInfo['current_update'] = db_get_sql("SELECT value FROM tupdate_settings WHERE \"key\" = 'current_update'"); break; case "oracle": @@ -72,7 +70,6 @@ function getPandoraDiagnostic(&$systemInfo) { $systemInfo['db_maintance'] = db_get_sql ("SELECT value FROM tconfig WHERE token = 'db_maintance'"); $systemInfo['customer_key'] = db_get_sql("SELECT value FROM tupdate_settings WHERE key = 'customer_key';"); $systemInfo['updating_code_path'] = db_get_sql("SELECT value FROM tupdate_settings WHERE key = 'updating_code_path'"); - $systemInfo['keygen_path'] = db_get_sql("SELECT value FROM tupdate_settings WHERE key = 'keygen_path'"); $systemInfo['current_update'] = db_get_sql("SELECT value FROM tupdate_settings WHERE key = 'current_update'"); break; } diff --git a/pandora_console/extensions/update_manager/sql/update_manager.oracle.sql b/pandora_console/extensions/update_manager/sql/update_manager.oracle.sql index 8b12b73f65..5d5d905138 100644 --- a/pandora_console/extensions/update_manager/sql/update_manager.oracle.sql +++ b/pandora_console/extensions/update_manager/sql/update_manager.oracle.sql @@ -1,7 +1,6 @@ CREATE TABLE tupdate_settings ( key VARCHAR2(255) default '' PRIMARY KEY, value VARCHAR2(255) default '') /INSERT INTO tupdate_settings VALUES ('current_update', '412') /INSERT INTO tupdate_settings VALUES ('customer_key', 'PANDORA-FREE') -/INSERT INTO tupdate_settings VALUES ('keygen_path', '/usr/share/pandora_server/keygen.i386.static') /INSERT INTO tupdate_settings VALUES ('update_server_host', 'www.artica.es') /INSERT INTO tupdate_settings VALUES ('update_server_port', '80') /INSERT INTO tupdate_settings VALUES ('update_server_path', '/pandoraupdate4/server.php') diff --git a/pandora_console/extensions/update_manager/sql/update_manager.postgreSQL.sql b/pandora_console/extensions/update_manager/sql/update_manager.postgreSQL.sql index b1ec1fd2f3..e6cc6dba97 100644 --- a/pandora_console/extensions/update_manager/sql/update_manager.postgreSQL.sql +++ b/pandora_console/extensions/update_manager/sql/update_manager.postgreSQL.sql @@ -1,5 +1,5 @@ CREATE TABLE "tupdate_settings" ( "key" varchar(255) default '' PRIMARY KEY, "value" varchar(255) default ''); -INSERT INTO "tupdate_settings" VALUES ('current_update', '412'), ('customer_key', 'PANDORA-FREE'), ('keygen_path', '/usr/share/pandora_server/keygen.i386.static'), ('update_server_host', 'www.artica.es'), ('update_server_port', '80'), ('update_server_path', '/pandoraupdate4/server.php'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('dbport', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', ''); +INSERT INTO "tupdate_settings" VALUES ('current_update', '412'), ('customer_key', 'PANDORA-FREE'), ('update_server_host', 'www.artica.es'), ('update_server_port', '80'), ('update_server_path', '/pandoraupdate4/server.php'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('dbport', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', ''); CREATE TABLE "tupdate_package"( "id" SERIAL NOT NULL PRIMARY KEY, "timestamp" TIMESTAMP without time zone default NULL, "description" varchar(255) default ''); CREATE TYPE type_tupdate_type AS ENUM ('code', 'db_data', 'db_schema', 'binary'); CREATE TABLE "tupdate" ( "id" SERIAL NOT NULL PRIMARY KEY, "type" type_tupdate_type, "id_update_package" INTEGER default 0 REFERENCES "tupdate_package"("id") ON UPDATE CASCADE ON DELETE CASCADE, "filename" varchar(250) default '', "checksum" varchar(250) default '', "previous_checksum" varchar(250) default '', "svn_version" INTEGER default 0, "data" TEXT default '', "data_rollback" TEXT default '', "description" TEXT default '', "db_table_name" varchar(140) default '', "db_field_name" varchar(140) default '', "db_field_value" varchar(1024) default ''); diff --git a/pandora_console/extensions/update_manager/sql/update_manager.sql b/pandora_console/extensions/update_manager/sql/update_manager.sql index 8a1bcea981..3f0401a18e 100644 --- a/pandora_console/extensions/update_manager/sql/update_manager.sql +++ b/pandora_console/extensions/update_manager/sql/update_manager.sql @@ -1,5 +1,5 @@ CREATE TABLE `tupdate_settings` ( `key` varchar(255) default '', `value` varchar(255) default '', PRIMARY KEY (`key`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -INSERT INTO `tupdate_settings` VALUES ('current_update', '412'), ('customer_key', 'PANDORA-FREE'), ('keygen_path', '/usr/share/pandora_server/keygen.i386.static'), ('update_server_host', 'www.artica.es'), ('update_server_port', '80'), ('update_server_path', '/pandoraupdate4/server.php'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('dbport', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', ''); +INSERT INTO `tupdate_settings` VALUES ('current_update', '412'), ('customer_key', 'PANDORA-FREE'), ('update_server_host', 'www.artica.es'), ('update_server_port', '80'), ('update_server_path', '/pandoraupdate4/server.php'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('dbport', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', ''); CREATE TABLE `tupdate_package` ( id int(11) unsigned NOT NULL auto_increment, timestamp datetime NOT NULL, description varchar(255) default '', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `tupdate` ( id int(11) unsigned NOT NULL auto_increment, type enum('code', 'db_data', 'db_schema', 'binary'), id_update_package int(11) unsigned NOT NULL default 0, filename varchar(250) default '', checksum varchar(250) default '', previous_checksum varchar(250) default '', svn_version int(4) unsigned NOT NULL default 0, data LONGTEXT default '', data_rollback LONGTEXT default '', description TEXT default '', db_table_name varchar(140) default '', db_field_name varchar(140) default '', db_field_value varchar(1024) default '', PRIMARY KEY (`id`), FOREIGN KEY (`id_update_package`) REFERENCES tupdate_package(`id`) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `tupdate_journal` ( id int(11) unsigned NOT NULL auto_increment, id_update int(11) unsigned NOT NULL default 0, PRIMARY KEY (`id`), FOREIGN KEY (`id_update`) REFERENCES tupdate(`id`) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/extras/pandora_diag.php b/pandora_console/extras/pandora_diag.php index 67316bade0..9aff382ed4 100644 --- a/pandora_console/extras/pandora_diag.php +++ b/pandora_console/extras/pandora_diag.php @@ -141,9 +141,6 @@ switch ($config["dbtype"]) { render_info_data ("SELECT value FROM tupdate_settings WHERE `key` = 'updating_code_path'", "Updating code path"); - render_info_data ("SELECT value - FROM tupdate_settings - WHERE `key` = 'keygen_path'", "Keygen path"); render_info_data ("SELECT value FROM tupdate_settings WHERE `key` = 'current_update'", "Current Update #"); @@ -168,9 +165,6 @@ switch ($config["dbtype"]) { render_info_data ("SELECT value FROM tupdate_settings WHERE \"key\" = 'updating_code_path'", "Updating code path"); - render_info_data ("SELECT value - FROM tupdate_settings - WHERE \"key\" = 'keygen_path'", "Keygen path"); render_info_data ("SELECT value FROM tupdate_settings WHERE \"key\" = 'current_update'", "Current Update #"); @@ -195,9 +189,6 @@ switch ($config["dbtype"]) { render_info_data ("SELECT value FROM tupdate_settings WHERE key = 'updating_code_path'", "Updating code path"); - render_info_data ("SELECT value - FROM tupdate_settings - WHERE key = 'keygen_path'", "Keygen path"); render_info_data ("SELECT value FROM tupdate_settings WHERE key = 'current_update'", "Current Update #"); diff --git a/pandora_console/godmode/massive/massive_delete_modules.php b/pandora_console/godmode/massive/massive_delete_modules.php index 4427c6ef58..5fa45b2246 100644 --- a/pandora_console/godmode/massive/massive_delete_modules.php +++ b/pandora_console/godmode/massive/massive_delete_modules.php @@ -88,12 +88,14 @@ function process_manage_delete ($module_name, $id_agents) { $success = modules_delete_agent_module ($modules); if (! $success) { - ui_print_error_message(__('There was an error deleting the modules, the operation has been cancelled')); + ui_print_error_message( + __('There was an error deleting the modules, the operation has been cancelled')); return false; } else { - ui_print_success_message(__('Successfully deleted') . ' (' . $count_deleted_modules . ')'); + ui_print_success_message( + __('Successfully deleted') . ' (' . $count_deleted_modules . ')'); return true; } diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index eacb766389..9448870ab1 100644 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -272,8 +272,12 @@ function modules_delete_agent_module ($id_agent_module) { return false; if (is_array($id_agent_module)) { - $id_agents = db_get_all_rows_sql (sprintf('SELECT id_agente FROM tagente_modulo WHERE id_agente_modulo IN (%s) GROUP BY id_agente', implode(',', $id_agent_module))); - + $id_agents = db_get_all_rows_sql( + sprintf('SELECT id_agente + FROM tagente_modulo + WHERE id_agente_modulo IN (%s) + GROUP BY id_agente', implode(',', $id_agent_module))); + foreach($id_agents as $k => $v) { $id_agents[$k] = $v['id_agente']; } @@ -292,16 +296,33 @@ function modules_delete_agent_module ($id_agent_module) { SET update_module_count=1, update_alert_count=1 WHERE id_agente = %s', $id_agent)); } - + $where = array ('id_agent_module' => $id_agent_module); - enterprise_hook('config_agents_delete_module_in_conf', array(modules_get_agentmodule_agent($id_agent_module), modules_get_agentmodule_name($id_agent_module))); + $enterprise_include = enterprise_include_once( + 'include/functions_config_agents.php'); + + if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { + if (is_array($id_agent_module)) { + foreach ($id_agent_module as $id_agent_module_item) { + config_agents_delete_module_in_conf( + modules_get_agentmodule_agent($id_agent_module_item), + modules_get_agentmodule_name($id_agent_module_item)); + } + } + else { + config_agents_delete_module_in_conf( + modules_get_agentmodule_agent($id_agent_module), + modules_get_agentmodule_name($id_agent_module)); + } + } alerts_delete_alert_agent_module (0, $where); db_process_sql_delete ('tgraph_source', $where); db_process_sql_delete ('treport_content', $where); - db_process_sql_delete ('tevento', array ('id_agentmodule' => $id_agent_module)); + db_process_sql_delete ('tevento', + array('id_agentmodule' => $id_agent_module)); $where = array ('id_agente_modulo' => $id_agent_module); db_process_sql_delete ('tlayout_data', $where); db_process_sql_delete ('tagente_estado', $where); diff --git a/pandora_console/pandoradb.data.oracle.sql b/pandora_console/pandoradb.data.oracle.sql index e7611329a6..29946f8e8a 100644 --- a/pandora_console/pandoradb.data.oracle.sql +++ b/pandora_console/pandoradb.data.oracle.sql @@ -1209,7 +1209,6 @@ INSERT INTO tevent_response VALUES (1,'Ping to host','Ping to INSERT INTO tupdate_settings VALUES ('current_update', '412'); INSERT INTO tupdate_settings VALUES ('customer_key', 'PANDORA-FREE'); -INSERT INTO tupdate_settings VALUES ('keygen_path', '/usr/share/pandora_server/keygen.i386.static'); INSERT INTO tupdate_settings VALUES ('update_server_host', 'www.artica.es'); INSERT INTO tupdate_settings VALUES ('update_server_port', '80'); INSERT INTO tupdate_settings VALUES ('update_server_path', '/pandoraupdate5/server.php'); diff --git a/pandora_console/pandoradb.data.postgreSQL.sql b/pandora_console/pandoradb.data.postgreSQL.sql index 61229e7bbc..2023fa29c1 100644 --- a/pandora_console/pandoradb.data.postgreSQL.sql +++ b/pandora_console/pandoradb.data.postgreSQL.sql @@ -1050,4 +1050,4 @@ INSERT INTO "ttag" VALUES (1,'network','Network equipment','http://artica.e INSERT INTO "tevent_response" VALUES (1,'Ping to host','Ping to the agent host','ping -c 5 _agent_address_','command',0,620,500,0,''),(2,'SSH to host','Connect via SSH to the agent','http://192.168.70.164:8022/anyterm.html?param=_User_@_agent_address_','url',0,800,450,0,'User'),(3,'Create incident from event','Create a incident from the event with the standard incidents system of Pandora FMS','index.php?sec=workspace&sec2=operation/incidents/incident_detail&insert_form&from_event=_event_id_','url',0,0,0,1,''),(4,'Create Integria IMS incident from event','Create a incident from the event with integria incidents system of Pandora FMS. Is necessary to enable and configure the Integria incidents in Pandora FMS setup.','index.php?sec=workspace&sec2=operation/integria_incidents/incident&tab=editor&from_event=_event_id_','url',0,0,0,1,''),(5,'Restart agent','Restart the agent with using UDP protocol. To use this response is necessary to have installed Pandora FMS server and console in the same machine.','/usr/share/pandora_server/util/udp_client.pl _agent_address_ 41122 "REFRESH AGENT"','command',0,620,500,0,''); -INSERT INTO "tupdate_settings" VALUES ('current_update', '412'), ('customer_key', 'PANDORA-FREE'), ('keygen_path', '/usr/share/pandora_server/keygen.i386.static'), ('update_server_host', 'www.artica.es'), ('update_server_port', '80'), ('update_server_path', '/pandoraupdate5/server.php'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('dbport', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', ''); +INSERT INTO "tupdate_settings" VALUES ('current_update', '412'), ('customer_key', 'PANDORA-FREE'), ('update_server_host', 'www.artica.es'), ('update_server_port', '80'), ('update_server_path', '/pandoraupdate5/server.php'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('dbport', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', ''); diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 4d9ead1fc3..834cfa19f0 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -1010,4 +1010,4 @@ INSERT INTO `ttag` VALUES (1,'network','Network equipment','http://artica.e INSERT INTO `tevent_response` VALUES (1,'Ping to host','Ping to the agent host','ping -c 5 _agent_address_','command',0,620,500,0,''),(2,'SSH to host','Connect via SSH to the agent','http://192.168.70.164:8022/anyterm.html?param=_User_@_agent_address_','url',0,800,450,0,'User'),(3,'Create incident from event','Create a incident from the event with the standard incidents system of Pandora FMS','index.php?sec=workspace&sec2=operation/incidents/incident_detail&insert_form&from_event=_event_id_','url',0,0,0,1,''),(4,'Create Integria IMS incident from event','Create a incident from the event with integria incidents system of Pandora FMS. Is necessary to enable and configure the Integria incidents in Pandora FMS setup.','index.php?sec=workspace&sec2=operation/integria_incidents/incident&tab=editor&from_event=_event_id_','url',0,0,0,1,''),(5,'Restart agent','Restart the agent with using UDP protocol. To use this response is necessary to have installed Pandora FMS server and console in the same machine.','/usr/share/pandora_server/util/udp_client.pl _agent_address_ 41122 "REFRESH AGENT"','command',0,620,500,0,''); -INSERT INTO `tupdate_settings` VALUES ('current_update', '412'), ('customer_key', 'PANDORA-FREE'), ('keygen_path', '/usr/share/pandora_server/keygen.i386.static'), ('update_server_host', 'www.artica.es'), ('update_server_port', '80'), ('update_server_path', '/pandoraupdate5/server.php'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('dbport', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', ''); +INSERT INTO `tupdate_settings` VALUES ('current_update', '412'), ('customer_key', 'PANDORA-FREE'), ('update_server_host', 'www.artica.es'), ('update_server_port', '80'), ('update_server_path', '/pandoraupdate5/server.php'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('dbport', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', '');