From 12a7d7570ab09435ae198f617403c91dd9825b10 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Mon, 1 Oct 2012 14:04:30 +0000 Subject: [PATCH] 2012-10-01 Sergio Martin * pandoradb.sql pandoradb.postgreSQL.sql pandoradb.oracle.sql extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: Added owner and ack timestamp to event table and new last known status in tagente_estado table git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7017 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 ++++++++++ .../pandoradb_migrate_4.0.x_to_5.0.mysql.sql | 8 +++++++ .../pandoradb_migrate_4.0.x_to_5.0.oracle.sql | 21 +++++++++++-------- ...doradb_migrate_4.0.x_to_5.0.postgreSQL.sql | 11 ++++++++-- pandora_console/pandoradb.oracle.sql | 5 ++++- pandora_console/pandoradb.postgreSQL.sql | 7 +++++-- pandora_console/pandoradb.sql | 3 +++ 7 files changed, 52 insertions(+), 14 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 933384c4c7..1de491f1b5 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2012-10-01 Sergio Martin + + * pandoradb.sql + pandoradb.postgreSQL.sql + pandoradb.oracle.sql + extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql + extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql + extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: Added + owner and ack timestamp to event table and new last known status + in tagente_estado table + 2012-10-01 Miguel de Dios * godmode/servers/recon_script.php, godmode/setup/setup.php, diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql index 0e0707d7e1..e3b6b77d9d 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql @@ -122,6 +122,8 @@ ALTER TABLE `tevento` MODIFY COLUMN `event_type` ENUM('going_unknown','unknown', ALTER TABLE `tevento` ADD COLUMN `critical_instructions` TEXT NOT NULL DEFAULT ''; ALTER TABLE `tevento` ADD COLUMN `warning_instructions` TEXT NOT NULL DEFAULT ''; ALTER TABLE `tevento` ADD COLUMN `unknown_instructions` TEXT NOT NULL DEFAULT ''; +ALTER TABLE `tevento` ADD COLUMN `owner_user` VARCHAR(100) NOT NULL DEFAULT ''; +ALTER TABLE `tevento` ADD COLUMN `ack_utimestamp` BIGINT(20) NOT NULL DEFAULT '0'; ------------------------------------------------------------------------ -- Table `tgrupo` @@ -146,6 +148,8 @@ ALTER TABLE `tagente_modulo` ADD COLUMN `quiet` tinyint(1) NOT NULL DEFAULT '0'; ALTER TABLE `tagente_modulo` ADD COLUMN `critical_instructions` TEXT NOT NULL DEFAULT ''; ALTER TABLE `tagente_modulo` ADD COLUMN `warning_instructions` TEXT NOT NULL DEFAULT ''; ALTER TABLE `tagente_modulo` ADD COLUMN `unknown_instructions` TEXT NOT NULL DEFAULT ''; +ALTER TABLE `tagente_modulo` ADD COLUMN `critical_inverse` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `tagente_modulo` ADD COLUMN `warning_inverse` tinyint(1) NOT NULL DEFAULT '0'; ------------------------------------------------------------------------ -- Table `tnetwork_component` @@ -303,3 +307,7 @@ ALTER TABLE tlayout_data ADD COLUMN `enable_link` tinyint(1) UNSIGNED NOT NULL ALTER TABLE tnetwork_map ADD `text_filter` VARCHAR(100) NOT NULL DEFAULT ""; ALTER TABLE tnetwork_map ADD `dont_show_subgroups` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0; +------------------------------------------------------------------------ +-- Table `tagente_estado` +------------------------------------------------------------------------ +ALTER TABLE `tagente_estado` ADD COLUMN `last_known_status` tinyint(4) NOT NULL DEFAULT 0; diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql index 98304d56ac..7076ccab39 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql @@ -143,6 +143,12 @@ CREATE OR REPLACE TRIGGER tplanned_downtime_modules_inc BEFORE INSERT ON tplanne -- ----------------------------------------------------- ALTER TABLE tevento ADD (source VARCHAR2(100) default '' NOT NULL); ALTER TABLE tevento ADD (id_extra VARCHAR2(100) default '' NOT NULL); +ALTER TABLE tevento ADD (critical_instructions VARCHAR2(255) default ''); +ALTER TABLE tevento ADD (warning_instructions VARCHAR2(255) default ''); +ALTER TABLE tevento ADD (unknown_instructions VARCHAR2(255) default ''); +ALTER TABLE tevento MODIFY CONSTRAINT tevento_event_type_cons CHECK (event_type IN ('going_unknown','unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal','going_down_critical','going_up_normal', 'configuration_change')) +ALTER TABLE tevento ADD (owner_user VARCHAR2(100) NOT NULL default '0'); +ALTER TABLE tevento ADD (ack_utimestamp NUMBER(19, 0) NOT NULL default 0); -- ----------------------------------------------------- -- Table `tgrupo` @@ -310,14 +316,6 @@ ALTER TABLE trecon_task MODIFY field1 TEXT NOT NULL; -- ----------------------------------------------------- ALTER TABLE tlayout_data ADD (enable_link NUMBER(5, 0) NOT NULL default 1); --- ----------------------------------------------------- --- Table `tevento` --- ----------------------------------------------------- -ALTER TABLE tevento ADD (critical_instructions VARCHAR2(255) default ''); -ALTER TABLE tevento ADD (warning_instructions VARCHAR2(255) default ''); -ALTER TABLE tevento ADD (unknown_instructions VARCHAR2(255) default ''); -ALTER TABLE tevento MODIFY CONSTRAINT tevento_event_type_cons CHECK (event_type IN ('going_unknown','unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal','going_down_critical','going_up_normal', 'configuration_change')) - -- ----------------------------------------------------- -- Table `tagente_modulo` -- ----------------------------------------------------- @@ -336,4 +334,9 @@ ALTER TABLE tnetwork_component ADD (unknown_instructions VARCHAR2(255) default ' -- Table `tnetwork_map` ------------------------------------------------------------------------ ALTER TABLE tnetwork_map ADD (text_filter VARCHAR(100) DEFAULT ''); -ALTER TABLE tnetwork_map ADD (dont_show_subgroups NUMBER(10, 0) default 0 NOT NULL); \ No newline at end of file +ALTER TABLE tnetwork_map ADD (dont_show_subgroups NUMBER(10, 0) default 0 NOT NULL); + +------------------------------------------------------------------------ +-- Table `tagente_estado` +------------------------------------------------------------------------ +ALTER TABLE tagente_estado ADD (last_known_status NUMBER(5, 0) default 0 NOT NULL); diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql index 094297bf7a..9d83112bc1 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql @@ -138,7 +138,9 @@ ALTER TABLE "tevento" ADD COLUMN "critical_instructions" text default ''; ALTER TABLE "tevento" ADD COLUMN "warning_instructions" text default ''; ALTER TABLE "tevento" ADD COLUMN "unknown_instructions" text default ''; ALTER TYPE type_tevento_event ADD VALUE 'going_unknown' BEFORE 'unknown'; - +ALTER TABLE "tevento" ADD COLUMN "owner_user" varchar(100) NOT NULL default '0'; +ALTER TABLE "tevento" ADD COLUMN "ack_utimestamp" BIGINT NOT NULL default 0; + -- ----------------------------------------------------- -- Table `tgrupo` -- ----------------------------------------------------- @@ -324,4 +326,9 @@ ALTER TABLE "tnetwork_component" ADD COLUMN "unknown_instructions" text default -- Table `tnetwork_map` ------------------------------------------------------------------------ ALTER TABLE "tnetwork_map" ADD COLUMN "text_filter" VARCHAR(100) DEFAULT ''; -ALTER TABLE "tnetwork_map" ADD COLUMN "dont_show_subgroups" INTEGER NOT NULL DEFAULT 0; \ No newline at end of file +ALTER TABLE "tnetwork_map" ADD COLUMN "dont_show_subgroups" INTEGER NOT NULL DEFAULT 0; + +------------------------------------------------------------------------ +-- Table `tagente_estado` +------------------------------------------------------------------------ +ALTER TABLE "tagente_estado" ADD COLUMN "last_known_status" INTEGER default 0; diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index bddbd4f83d..16a6173ac3 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -153,7 +153,8 @@ CREATE TABLE tagente_estado ( running_by NUMBER(10, 0) default 0, last_execution_try NUMBER(19, 0) default 0 NOT NULL, status_changes NUMBER(10, 0) default 0, - last_status NUMBER(10, 0) default 0 + last_status NUMBER(10, 0) default 0, + last_known_status NUMBER(10, 0) default 0 ); CREATE INDEX tagente_estado_id_agente_idx ON tagente_estado(id_agente); CREATE INDEX tagente_estado_estado_idx ON tagente_estado(estado); @@ -544,6 +545,8 @@ CREATE TABLE tevento ( critical_instructions VARCHAR2(255) default '', warning_instructions VARCHAR2(255) default '', unknown_instructions VARCHAR2(255) default '', + owner_user VARCHAR2(100) default '0' NOT NULL, + ack_utimestamp NUMBER(19, 0) default 0 NOT NULL, CONSTRAINT tevento_event_type_cons CHECK (event_type IN ('going_unknown','unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal','going_down_critical','going_up_normal', 'configuration_change')) ); CREATE INDEX tevento_id_1_idx ON tevento(id_agente, id_evento); diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index 458e33c808..c6e6c91816 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -146,7 +146,8 @@ CREATE TABLE "tagente_estado" ( "running_by" INTEGER default 0, "last_execution_try" BIGINT NOT NULL default 0, "status_changes" INTEGER default 0, - "last_status" INTEGER default 0 + "last_status" INTEGER default 0, + "last_known_status" INTEGER default 0 ); CREATE INDEX "tagente_estado_id_agente_modulo_idx" ON "tagente_estado"("id_agente_modulo"); CREATE INDEX "tagente_estado_id_agente_idx" ON "tagente_estado"("id_agente"); @@ -444,7 +445,9 @@ CREATE TABLE "tevento" ( "id_extra" text NOT NULL default '', "critical_instructions" TEXT default '', "warning_instructions" TEXT default '', - "unknown_instructions" TEXT default '' + "unknown_instructions" TEXT default '', + "owner_user" varchar(100) NOT NULL default '0', + "ack_utimestamp" BIGINT NOT NULL default 0 ); CREATE INDEX "tevento_id_1_idx" ON "tevento"("id_agente", "id_evento"); CREATE INDEX "tevento_id_2_idx" ON "tevento"("utimestamp", "id_evento"); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index bcffed8f06..fd7a8c9651 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -145,6 +145,7 @@ CREATE TABLE `tagente_estado` ( `last_execution_try` bigint(20) NOT NULL default '0', `status_changes` tinyint(4) default 0, `last_status` tinyint(4) default 0, + `last_known_status` tinyint(4) default 0, PRIMARY KEY (`id_agente_estado`), KEY `status_index_1` (`id_agente_modulo`), KEY `idx_agente` (`id_agente`), @@ -523,6 +524,8 @@ CREATE TABLE IF NOT EXISTS `tevento` ( `critical_instructions` text NOT NULL default '', `warning_instructions` text NOT NULL default '', `unknown_instructions` text NOT NULL default '', + `owner_user` VARCHAR(100) NOT NULL DEFAULT '', + `ack_utimestamp` BIGINT(20) NOT NULL DEFAULT '0', PRIMARY KEY (`id_evento`), KEY `indice_1` (`id_agente`,`id_evento`), KEY `indice_2` (`utimestamp`,`id_evento`),