From b60a8143d6d83171636db6a463b7e89ffa268bdc Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Mon, 10 Dec 2012 15:52:51 +0000 Subject: [PATCH] 2012-12-10 Juan Manuel Ramon * pandoradb_data.sql pandoradb.sql pandoradb.postgreSQL.sql pandoradb.oracle.sql extensions/update_manager.php pandoradb.data.postgreSQL.sql pandoradb.data.oracle.sql: Added table tupdate_settings; git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7246 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 +++ pandora_console/extensions/update_manager.php | 4 ++ pandora_console/pandoradb.data.oracle.sql | 21 ++++++ pandora_console/pandoradb.data.postgreSQL.sql | 5 +- pandora_console/pandoradb.oracle.sql | 68 ++++++++++++++++++- pandora_console/pandoradb.postgreSQL.sql | 47 +++++++++++++ pandora_console/pandoradb.sql | 46 +++++++++++++ pandora_console/pandoradb_data.sql | 5 +- 8 files changed, 202 insertions(+), 4 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 1e447a1514..ade503136b 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2012-12-10 Juan Manuel Ramon + + * pandoradb_data.sql + pandoradb.sql + pandoradb.postgreSQL.sql + pandoradb.oracle.sql + extensions/update_manager.php + pandoradb.data.postgreSQL.sql + pandoradb.data.oracle.sql: Added table tupdate_settings; + 2012-12-10 Miguel de Dios * db/mysql.php: finish to fixed the insert in the metaconsoles. diff --git a/pandora_console/extensions/update_manager.php b/pandora_console/extensions/update_manager.php index a1b514f8a5..91d4d1fa51 100644 --- a/pandora_console/extensions/update_manager.php +++ b/pandora_console/extensions/update_manager.php @@ -97,6 +97,10 @@ function pandora_update_manager_install () { load_update_manager_lib (); + if ($config['update_manager_installed'] == 1) { + return; + } + /* SQL installation */ switch ($config['dbtype']) { case 'mysql': diff --git a/pandora_console/pandoradb.data.oracle.sql b/pandora_console/pandoradb.data.oracle.sql index 0c1f8cd667..9b942390d8 100644 --- a/pandora_console/pandoradb.data.oracle.sql +++ b/pandora_console/pandoradb.data.oracle.sql @@ -107,6 +107,7 @@ INSERT INTO tconfig (token, value) VALUES ('compare_pass', 3); INSERT INTO tconfig (token, value) VALUES ('meta_style', 'meta_pandora'); INSERT INTO tconfig (token, value) VALUES ('enable_refr', 0); INSERT INTO tconfig (token, value) VALUES ('meta_num_elements', 100); +INSERT INTO tconfig (token, value) VALUES ('update_manager_installed', 1); COMMIT; END;; @@ -612,3 +613,23 @@ INSERT INTO tagent_custom_fields VALUES (1,'Serial Number',0),(2,'Departmen INSERT INTO ttag VALUES (1,'network','Network equipment','http://artica.es'),(2,'critical','Critical modules',''),(3,'dmz','DMZ Network Zone',''),(4,'performance','Performance anda capacity modules',''),(5,'configuration','',''); 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/udp_client.pl _agent_address_ 41122 "REFRESH AGENT"','command',0,620,500,0,''); + +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'); +INSERT INTO tupdate_settings VALUES ('updating_binary_path', 'Path where the updated binary files will be stored'); +INSERT INTO tupdate_settings VALUES ('updating_code_path', 'Path where the updated code is stored'); +INSERT INTO tupdate_settings VALUES ('dbname', ''); +INSERT INTO tupdate_settings VALUES ('dbhost', ''); +INSERT INTO tupdate_settings VALUES ('dbpass', ''); +INSERT INTO tupdate_settings VALUES ('dbuser', ''); +INSERT INTO tupdate_settings VALUES ('dbport', ''); +INSERT INTO tupdate_settings VALUES ('proxy', ''); +INSERT INTO tupdate_settings VALUES ('proxy_port', ''); +INSERT INTO tupdate_settings VALUES ('proxy_user', ''); +INSERT INTO tupdate_settings VALUES ('proxy_pass', ''); + +COMMIT; diff --git a/pandora_console/pandoradb.data.postgreSQL.sql b/pandora_console/pandoradb.data.postgreSQL.sql index 592d6e490d..31a70f6698 100644 --- a/pandora_console/pandoradb.data.postgreSQL.sql +++ b/pandora_console/pandoradb.data.postgreSQL.sql @@ -102,7 +102,8 @@ INSERT INTO "tconfig" ("token", "value") VALUES ('compare_pass', 3), ('meta_style', 'meta_pandora'), ('enable_refr', '0'), -('meta_num_elements', 100); +('meta_num_elements', 100), +('update_manager_installed', 1); COMMIT WORK; @@ -453,3 +454,5 @@ INSERT INTO "tagent_custom_fields" VALUES (1,'Serial Number',0),(2,'Departm INSERT INTO "ttag" VALUES (1,'network','Network equipment','http://artica.es'),(2,'critical','Critical modules',''),(3,'dmz','DMZ Network Zone',''),(4,'performance','Performance anda capacity modules',''),(5,'configuration','',''); 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/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', '/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', ''); diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 7359f3b57f..a04828f3c0 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -1745,22 +1745,27 @@ CREATE TABLE tevent_filter ( filter_only_alert NUMBER(10, 0) default -1 NOT NULL ); +CREATE SEQUENCE tevent_filter_s INCREMENT BY 1 START WITH 1; +CREATE OR REPLACE TRIGGER tevent_filter_inc BEFORE INSERT ON tevent_filter REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tevent_filter_s.nextval INTO :NEW.ID_FILTER FROM dual; END tevent_filter_inc;; + -- --------------------------------------------------------------------- -- Table `tpassword_history` -- --------------------------------------------------------------------- -CREATE TABLE IF NOT EXISTS tpassword_history ( +CREATE TABLE tpassword_history ( id_pass NUMBER(10) NOT NULL PRIMARY KEY, id_user varchar2(60) NOT NULL, password varchar2(45) default '', date_begin TIMESTAMP DEFAULT 0, date_end TIMESTAMP DEFAULT 0 ); + CREATE SEQUENCE tpassword_history_s INCREMENT BY 1 START WITH 1; +CREATE OR REPLACE TRIGGER tpassword_history_inc BEFORE INSERT ON tpassword_history REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tpassword_history_s.nextval INTO :NEW.ID_PASS FROM dual; END tpassword_history_inc;; -- --------------------------------------------------------------------- -- Table `tevent_response` -- --------------------------------------------------------------------- -CREATE TABLE IF NOT EXISTS tevent_response ( +CREATE TABLE tevent_response ( id NUMBER(10) NOT NULL PRIMARY KEY, name varchar2(600) NOT NULL default '', description CLOB, @@ -1772,7 +1777,9 @@ CREATE TABLE IF NOT EXISTS tevent_response ( new_window NUMBER(10, 0) NOT NULL DEFAULT 0, params CLOB ); + CREATE SEQUENCE tevent_response_s INCREMENT BY 1 START WITH 1; +CREATE OR REPLACE TRIGGER tevent_response_inc BEFORE INSERT ON tevent_response REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tevent_response_s.nextval INTO :NEW.ID FROM dual; END tevent_response_inc;; -- --------------------------------------------------------------------- -- Table "tcategory" @@ -1781,3 +1788,60 @@ CREATE TABLE tcategory ( id NUMBER(10, 0) NOT NULL PRIMARY KEY, name VARCHAR2(600) default '' NOT NULL ); + +-- --------------------------------------------------------------------- +-- Table `tupdate_settings` +-- --------------------------------------------------------------------- +CREATE TABLE tupdate_settings ( + key VARCHAR2(255) default '' PRIMARY KEY, + value VARCHAR2(255) default '' +); + +-- --------------------------------------------------------------------- +-- Table `tupdate_package` +-- --------------------------------------------------------------------- +CREATE TABLE tupdate_package( + id NUMBER(10, 0) NOT NULL PRIMARY KEY, + timestamp TIMESTAMP default NULL, + description VARCHAR2(255) default '' +); + +CREATE SEQUENCE tupdate_package_s INCREMENT BY 1 START WITH 1; +CREATE OR REPLACE TRIGGER tupdate_package_inc BEFORE INSERT ON tupdate_package REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tupdate_package_s.nextval INTO :NEW.ID FROM dual; END tupdate_package_inc;; + +-- --------------------------------------------------------------------- +-- Table `tupdate` +-- --------------------------------------------------------------------- +CREATE TABLE tupdate ( + id NUMBER(10, 0) NOT NULL PRIMARY KEY, + type VARCHAR2(15), + id_update_package NUMBER(10, 0) default 0 REFERENCES tupdate_package(id) ON DELETE CASCADE, + filename VARCHAR2(250) default '', + checksum VARCHAR2(250) default '', + previous_checksum VARCHAR2(250) default '', + svn_version NUMBER(10, 0) default 0, + data CLOB default '', + data_rollback CLOB default '', + description CLOB default '', + db_table_name VARCHAR2(140) default '', + db_field_name VARCHAR2(140) default '', + db_field_value VARCHAR2(1024) default '', + CONSTRAINT tupdate_type_cons CHECK (type IN ('code', 'db_data', 'db_schema', 'binary')) +); + +CREATE SEQUENCE tupdate_s INCREMENT BY 1 START WITH 1; +CREATE OR REPLACE TRIGGER tupdate_inc BEFORE INSERT ON tupdate REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tupdate_s.nextval INTO :NEW.ID FROM dual; END;; +CREATE OR REPLACE TRIGGER tupdate_update AFTER UPDATE OF ID ON tupdate_package FOR EACH ROW BEGIN UPDATE tupdate SET ID_UPDATE_PACKAGE = :NEW.ID WHERE ID_UPDATE_PACKAGE = :OLD.ID; END;; + +-- --------------------------------------------------------------------- +-- Table `tupdate_journal` +-- --------------------------------------------------------------------- +CREATE TABLE tupdate_journal ( + id NUMBER(10, 0) NOT NULL PRIMARY KEY, + id_update NUMBER(10, 0) default 0 REFERENCES tupdate(id) ON DELETE CASCADE +); + +CREATE SEQUENCE tupdate_journal_s INCREMENT BY 1 START WITH 1; +CREATE OR REPLACE TRIGGER tupdate_journal_inc BEFORE INSERT ON tupdate_journal REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tupdate_journal_s.nextval INTO :NEW.ID FROM dual; END;; +CREATE OR REPLACE TRIGGER tupdate_journal_update AFTER UPDATE OF ID ON tupdate FOR EACH ROW BEGIN UPDATE tupdate_journal SET ID = :NEW.ID WHERE ID = :OLD.ID; END;; + diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index bf74e5e863..677424dda5 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -1541,3 +1541,50 @@ CREATE TABLE IF NOT EXISTS "tcategory" ( "id" SERIAL NOT NULL PRIMARY KEY, "name" varchar(600) NOT NULL default '', ); + +-- ----------------------------------------------------- +-- Table `tupdate_settings` +-- ----------------------------------------------------- +CREATE TABLE "tupdate_settings" ( + "key" varchar(255) default '' PRIMARY KEY, + "value" varchar(255) default '' +); + +-- ----------------------------------------------------- +-- Table `tupdate_package` +-- ----------------------------------------------------- +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'); + +-- ----------------------------------------------------- +-- Table `tupdate` +-- ----------------------------------------------------- +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 '' +); + +-- ----------------------------------------------------- +-- Table `tupdate_journal` +-- ----------------------------------------------------- +CREATE TABLE "tupdate_journal" ( + "id" SERIAL NOT NULL PRIMARY KEY, + "id_update" INTEGER default 0 REFERENCES "tupdate"("id") ON UPDATE CASCADE ON DELETE CASCADE +); + diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 23ddf970d9..2b3af69c5c 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1670,3 +1670,49 @@ CREATE TABLE IF NOT EXISTS `tcategory` ( `name` varchar(600) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- --------------------------------------------------------------------- +-- Table `tupdate_settings` +-- --------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tupdate_settings` ( + `key` varchar(255) default '', + `value` varchar(255) default '', PRIMARY KEY (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- --------------------------------------------------------------------- +-- Table `tupdate_package` +-- --------------------------------------------------------------------- +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; + +-- --------------------------------------------------------------------- +-- Table `tupdate` +-- --------------------------------------------------------------------- +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; + +-- --------------------------------------------------------------------- +-- Table `tupdate_journal` +-- --------------------------------------------------------------------- +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/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 771173fee1..1fffff9d96 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -101,7 +101,8 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('compare_pass', 3), ('meta_style', 'meta_pandora'), ('enable_refr', 0), -('meta_num_elements', 100); +('meta_num_elements', 100), +('update_manager_installed', 1); UNLOCK TABLES; @@ -441,3 +442,5 @@ INSERT INTO `tagent_custom_fields` VALUES (1,'Serial Number',0),(2,'Departm INSERT INTO `ttag` VALUES (1,'network','Network equipment','http://artica.es'),(2,'critical','Critical modules',''),(3,'dmz','DMZ Network Zone',''),(4,'performance','Performance anda capacity modules',''),(5,'configuration','',''); 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/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', '/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', '');