From 81cde4dc910169a8f4c14942c62e48fb99e14d90 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 24 Oct 2012 14:01:54 +0000 Subject: [PATCH] 2012-10-24 Miguel de Dios * extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql, extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql, pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql: added the fields "show_groups", "show_modules" into the table "tnetwork_map". * include/functions_modules.php: added two parameters (flag metaconsole, id_server) into the functions "modules_get_agentmodule_is_init", "modules_get_agentmodule_type" and "modules_get_agentmodule_status" for to extract data in the metaconsole enviroments. * include/functions_networkmap.php: added two parameters (flag metaconsole, id_server) into the functions "networkmap_create_agent_node" and "networkmap_create_module_node". git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7087 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 18 ++ .../pandoradb_migrate_4.0.x_to_5.0.mysql.sql | 14 +- .../pandoradb_migrate_4.0.x_to_5.0.oracle.sql | 2 + ...doradb_migrate_4.0.x_to_5.0.postgreSQL.sql | 2 + pandora_console/include/functions_modules.php | 76 +++++-- .../include/functions_networkmap.php | 19 +- pandora_console/pandoradb.oracle.sql | 12 +- pandora_console/pandoradb.postgreSQL.sql | 4 +- pandora_console/pandoradb.sql | 198 +++++++++--------- 9 files changed, 215 insertions(+), 130 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index fa0f53260d..0fc5ba6e62 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,21 @@ +2012-10-24 Miguel de Dios + + * extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, + extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql, + extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql, pandoradb.sql, + pandoradb.postgreSQL.sql, pandoradb.oracle.sql: added the fields + "show_groups", "show_modules" into the table "tnetwork_map". + + * include/functions_modules.php: added two parameters + (flag metaconsole, id_server) into the functions + "modules_get_agentmodule_is_init", "modules_get_agentmodule_type" + and "modules_get_agentmodule_status" for to extract data in the + metaconsole enviroments. + + * include/functions_networkmap.php: added two parameters + (flag metaconsole, id_server) into the functions + "networkmap_create_agent_node" and "networkmap_create_module_node". + 2012-10-23 Ramon Novoa * include/help/en/help_alert_macros.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 d246c1583f..69f2e85032 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 @@ -162,12 +162,12 @@ ALTER TABLE `tagente_modulo` ADD COLUMN `cron_interval` varchar(100) default ''; ------------------------------------------------------------------------ ALTER TABLE `tnetwork_component` CHANGE COLUMN `post_process` `post_process` double(18,5) default NULL; ALTER TABLE `tnetwork_component` ADD COLUMN `unit` TEXT NOT NULL AFTER `post_process`; -ALTER TABLE tnetwork_component ADD `wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard'; -ALTER TABLE tnetwork_component ADD `only_metaconsole` tinyint(1) unsigned default '0'; -ALTER TABLE tnetwork_component ADD `macros` text; -ALTER TABLE tnetwork_component ADD `critical_instructions` TEXT NOT NULL default ''; -ALTER TABLE tnetwork_component ADD `warning_instructions` TEXT NOT NULL default ''; -ALTER TABLE tnetwork_component ADD `unknown_instructions` TEXT NOT NULL default ''; +ALTER TABLE `tnetwork_component` ADD COLUMN `wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard'; +ALTER TABLE `tnetwork_component` ADD COLUMN `only_metaconsole` tinyint(1) unsigned default '0'; +ALTER TABLE `tnetwork_component` ADD COLUMN `macros` text; +ALTER TABLE `tnetwork_component` ADD COLUMN `critical_instructions` TEXT NOT NULL default ''; +ALTER TABLE `tnetwork_component` ADD COLUMN `warning_instructions` TEXT NOT NULL default ''; +ALTER TABLE `tnetwork_component` ADD COLUMN `unknown_instructions` TEXT NOT NULL default ''; ALTER TABLE `tnetwork_component` ADD COLUMN `critical_inverse` tinyint(1) unsigned default '0'; ALTER TABLE `tnetwork_component` ADD COLUMN `warning_inverse` tinyint(1) unsigned default '0'; @@ -315,6 +315,8 @@ 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; ALTER TABLE tnetwork_map ADD `pandoras_children` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE tnetwork_map ADD `show_groups` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE tnetwork_map ADD `show_modules` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0; -- ---------------------------------------------------------------------- -- Table `tagente_estado` 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 79fb84f7aa..de867e9403 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 @@ -346,6 +346,8 @@ evento 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); ALTER TABLE tnetwork_map ADD (pandoras_children NUMBER(10, 0) default 0 NOT NULL); +ALTER TABLE tnetwork_map ADD (show_modules NUMBER(10, 0) default 0 NOT NULL); +ALTER TABLE tnetwork_map ADD (show_groups NUMBER(10, 0) default 0 NOT NULL); ------------------------------------------------------------------------ -- Table `tagente_estado` 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 1573cf5416..485b46d926 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 @@ -337,6 +337,8 @@ ALTER TABLE "tnetwork_component" ADD COLUMN "warning_inverse" SMALLINT NOT NULL 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; ALTER TABLE "tnetwork_map" ADD COLUMN "pandoras_children" INTEGER NOT NULL DEFAULT 0; +ALTER TABLE "tnetwork_map" ADD COLUMN "show_modules" INTEGER NOT NULL DEFAULT 0; +ALTER TABLE "tnetwork_map" ADD COLUMN "show_groups" INTEGER NOT NULL DEFAULT 0; ------------------------------------------------------------------------ -- Table `tagente_estado` diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index f0721c4d56..7aa4f9035c 100644 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -570,14 +570,28 @@ function modules_get_agentmodule_id ($agentmodule_name, $agent_id) { /** * Get a if a module is init. * - * @param int agentmodule id to get. + * @param int $agentmodule Id to get. + * @param bool $metaconsole Flag to extract the data for metaconsole, by default false. + * @param int $id_server Id of children console. * * @return bool true if is init and false if is not init */ -function modules_get_agentmodule_is_init ($id_agentmodule) { - $result = db_get_row_filter ('tagente_estado', - array('id_agente_modulo' => $id_agentmodule), - 'utimestamp'); +function modules_get_agentmodule_is_init ($id_agentmodule, $metaconsole = false, $id_server = null) { + if ($metaconsole) { + $server = db_get_row('tmetaconsole_setup', 'id', $id_server); + + if (metaconsole_connect($server) == NOERR) { + $result = db_get_row_filter ('tagente_estado', + array('id_agente_modulo' => $id_agentmodule), + 'utimestamp'); + } + metaconsole_restore_db(); + } + else { + $result = db_get_row_filter ('tagente_estado', + array('id_agente_modulo' => $id_agentmodule), + 'utimestamp'); + } return (bool)$result['utimestamp']; } @@ -670,8 +684,21 @@ function modules_get_agentmodule_name ($id_agente_modulo) { * * @return string Module type of the given agent module. */ -function modules_get_agentmodule_type ($id_agentmodule) { - return (int) db_get_value ('id_tipo_modulo', 'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule); +function modules_get_agentmodule_type ($id_agentmodule, $metaconsole = false, $id_server = null) { + if ($metaconsole) { + $server = db_get_row('tmetaconsole_setup', 'id', $id_server); + + $return = db_get_value ('id_tipo_modulo', + 'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule); + + metaconsole_restore_db(); + } + else { + $return = db_get_value ('id_tipo_modulo', + 'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule); + } + + return (int) $return; } /** @@ -1057,17 +1084,38 @@ function modules_give_agent_id_from_module_id ($id_agent_module) { * @return int Module status. Value 4 means that some alerts assigned to the * module were fired. */ -function modules_get_agentmodule_status($id_agentmodule = 0, $without_alerts = false) { +function modules_get_agentmodule_status($id_agentmodule = 0, $without_alerts = false, $metaconsole = false, $id_server = null) { $current_timestamp = get_system_time (); - if (!$without_alerts) { - $times_fired = db_get_value ('SUM(times_fired)', 'talert_template_modules', 'id_agent_module', $id_agentmodule); - if ($times_fired > 0) { - return AGENT_MODULE_STATUS_CRITICAL_ALERT; // Alert fired + if ($metaconsole) { + $server = db_get_row('tmetaconsole_setup', 'id', $id_server); + + if (metaconsole_connect($server) == NOERR) { + + if (!$without_alerts) { + $times_fired = db_get_value ('SUM(times_fired)', 'talert_template_modules', 'id_agent_module', $id_agentmodule); + if ($times_fired > 0) { + return AGENT_MODULE_STATUS_CRITICAL_ALERT; // Alert fired + } + } + + $status_row = db_get_row ("tagente_estado", "id_agente_modulo", $id_agentmodule); + } + metaconsole_restore_db(); + } + else { + + + if (!$without_alerts) { + $times_fired = db_get_value ('SUM(times_fired)', 'talert_template_modules', 'id_agent_module', $id_agentmodule); + if ($times_fired > 0) { + return AGENT_MODULE_STATUS_CRITICAL_ALERT; // Alert fired + } + } + + $status_row = db_get_row ("tagente_estado", "id_agente_modulo", $id_agentmodule); } - - $status_row = db_get_row ("tagente_estado", "id_agente_modulo", $id_agentmodule); return $status_row['estado']; } diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index 3249d1ce84..2bf6a6fe6f 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -132,8 +132,9 @@ function networkmap_generate_dot ($pandora_name, $group = 0, $simple = 0, $node_count ++; $agent_module = modules_get_agentmodule($key); - $alerts_module = db_get_sql('SELECT count(*) as num - FROM talert_template_modules WHERE id_agent_module = '.$key); + $alerts_module = db_get_sql('SELECT count(*) AS num + FROM talert_template_modules + WHERE id_agent_module = ' . $key); // Save node parent information to define edges later $parents[$node_count] = $agent_module['parent'] = $agent['id_node']; @@ -467,10 +468,15 @@ function networkmap_create_group_node ($group, $simple = 0, $font_size = 10) { } // Returns a node definition -function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cut_names = true, $relative = false) { +function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cut_names = true, $relative = false, $metaconsole = false, $id_server = null) { global $config; - $status = agents_get_status($agent['id_agente']); + if (defined('METACONSOLE')) { + $status = agents_meta_get_status($id_server, $agent['id_agente']); + } + else { + $status = agents_get_status($agent['id_agente']); + } // Set node status switch ($status) { @@ -541,8 +547,9 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu } // Returns a module node definition -function networkmap_create_module_node ($module, $simple = 0, $font_size = 10) { - $status = modules_get_agentmodule_status($module['id_agente_modulo']); +function networkmap_create_module_node ($module, $simple = 0, $font_size = 10, $metaconsole = true, $id_server = null) { + $status = modules_get_agentmodule_status($module['id_agente_modulo'], + false, $metaconsole, $id_server); // Set node status switch($status) { diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 9881b9b3f1..61d08bc9eb 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -1461,9 +1461,9 @@ CREATE TABLE tgis_map_layer_has_tagente ( CREATE INDEX tgis_map_layer_has_tagente_idx ON tgis_map_layer_has_tagente(tgis_map_layer_id_tmap_layer); CREATE INDEX tgis_map_layer_has_tagent1_idx ON tgis_map_layer_has_tagente(tagente_id_agente); --- ----------------------------------------------------- +-- --------------------------------------------------------------------- -- Table "tgroup_stat" --- ----------------------------------------------------- +-- --------------------------------------------------------------------- --Table to store global system stats per group CREATE TABLE tgroup_stat ( id_group NUMBER(10, 0) default 0 NOT NULL PRIMARY KEY, @@ -1506,16 +1506,18 @@ CREATE TABLE tnetwork_map ( show_snmp_modules NUMBER(5, 0) default 0 NOT NULL, text_filter VARCHAR(100) DEFAULT '', dont_show_subgroups NUMBER(10, 0) default 0 NOT NULL, - pandoras_children NUMBER(10, 0) default 0 NOT NULL + pandoras_children NUMBER(10, 0) default 0 NOT NULL, + show_groups NUMBER(10, 0) default 0 NOT NULL, + show_modules NUMBER(10, 0) default 0 NOT NULL ); CREATE SEQUENCE tnetwork_map_s INCREMENT BY 1 START WITH 1; CREATE OR REPLACE TRIGGER tnetwork_map_inc BEFORE INSERT ON tnetwork_map REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tnetwork_map_s.nextval INTO :NEW.ID_NETWORKMAP FROM dual; END tnetwork_map_inc;; --- ----------------------------------------------------- +-- --------------------------------------------------------------------- -- Table "tsnmp_filter" --- ----------------------------------------------------- +-- --------------------------------------------------------------------- CREATE TABLE tsnmp_filter ( id_snmp_filter NUMBER(10, 0) NOT NULL PRIMARY KEY, description VARCHAR2(255) default '', diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index 3878d0c1da..1451063631 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -1284,7 +1284,9 @@ CREATE TABLE "tnetwork_map" ( "show_snmp_modules" SMALLINT NOT NULL default 0, "text_filter" VARCHAR(100) DEFAULT '', "dont_show_subgroups" INTEGER NOT NULL default 0, - "pandoras_children" INTEGER NOT NULL default 0 + "pandoras_children" INTEGER NOT NULL default 0, + "show_modules" INTEGER NOT NULL default 0, + "show_groups" INTEGER NOT NULL default 0 ); ------------------------------------------------------------------------ diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index e9bd6c76e4..91ae97c717 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1339,23 +1339,23 @@ COMMENT = 'Table to store the map connection information'; -- Table `tgis_map_has_tgis_map_connection` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tgis_map_has_tgis_map_connection` ( - `tgis_map_id_tgis_map` INT NOT NULL COMMENT 'reference to tgis_map' , - `tgis_map_connection_id_tmap_connection` INT NOT NULL COMMENT 'reference to tgis_map_connection' , - `modification_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Last Modification Time of the Connection' , - `default_map_connection` TINYINT(1) NULL DEFAULT FALSE COMMENT 'Flag to mark the default map connection of a map' , - PRIMARY KEY (`tgis_map_id_tgis_map`, `tgis_map_connection_id_tmap_connection`) , - INDEX `fk_tgis_map_has_tgis_map_connection_tgis_map1` (`tgis_map_id_tgis_map` ASC) , - INDEX `fk_tgis_map_has_tgis_map_connection_tgis_map_connection1` (`tgis_map_connection_id_tmap_connection` ASC) , - CONSTRAINT `fk_tgis_map_has_tgis_map_connection_tgis_map1` - FOREIGN KEY (`tgis_map_id_tgis_map` ) - REFERENCES `tgis_map` (`id_tgis_map` ) - ON DELETE CASCADE - ON UPDATE NO ACTION, - CONSTRAINT `fk_tgis_map_has_tgis_map_connection_tgis_map_connection1` - FOREIGN KEY (`tgis_map_connection_id_tmap_connection` ) - REFERENCES `tgis_map_connection` (`id_tmap_connection` ) - ON DELETE CASCADE - ON UPDATE NO ACTION) + `tgis_map_id_tgis_map` INT NOT NULL COMMENT 'reference to tgis_map' , + `tgis_map_connection_id_tmap_connection` INT NOT NULL COMMENT 'reference to tgis_map_connection' , + `modification_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Last Modification Time of the Connection' , + `default_map_connection` TINYINT(1) NULL DEFAULT FALSE COMMENT 'Flag to mark the default map connection of a map' , + PRIMARY KEY (`tgis_map_id_tgis_map`, `tgis_map_connection_id_tmap_connection`) , + INDEX `fk_tgis_map_has_tgis_map_connection_tgis_map1` (`tgis_map_id_tgis_map` ASC) , + INDEX `fk_tgis_map_has_tgis_map_connection_tgis_map_connection1` (`tgis_map_connection_id_tmap_connection` ASC) , + CONSTRAINT `fk_tgis_map_has_tgis_map_connection_tgis_map1` + FOREIGN KEY (`tgis_map_id_tgis_map` ) + REFERENCES `tgis_map` (`id_tgis_map` ) + ON DELETE CASCADE + ON UPDATE NO ACTION, + CONSTRAINT `fk_tgis_map_has_tgis_map_connection_tgis_map_connection1` + FOREIGN KEY (`tgis_map_connection_id_tmap_connection` ) + REFERENCES `tgis_map_connection` (`id_tmap_connection` ) + ON DELETE CASCADE + ON UPDATE NO ACTION) ENGINE = InnoDB COMMENT = 'Table to asociate a connection to a gis map'; @@ -1363,19 +1363,19 @@ COMMENT = 'Table to asociate a connection to a gis map'; -- Table `tgis_map_layer` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tgis_map_layer` ( - `id_tmap_layer` INT NOT NULL AUTO_INCREMENT COMMENT 'table id' , - `layer_name` VARCHAR(45) NOT NULL COMMENT 'Name of the layer ' , - `view_layer` TINYINT(1) NOT NULL DEFAULT TRUE COMMENT 'True if the layer must be shown' , - `layer_stack_order` TINYINT(3) NULL DEFAULT 0 COMMENT 'Number of order of the layer in the layer stack, bigger means upper on the stack.\n' , - `tgis_map_id_tgis_map` INT NOT NULL COMMENT 'reference to the map containing the layer' , - `tgrupo_id_grupo` MEDIUMINT(4) NOT NULL COMMENT 'reference to the group shown in the layer' , - PRIMARY KEY (`id_tmap_layer`) , - INDEX `fk_tmap_layer_tgis_map1` (`tgis_map_id_tgis_map` ASC) , - CONSTRAINT `fk_tmap_layer_tgis_map1` - FOREIGN KEY (`tgis_map_id_tgis_map` ) - REFERENCES `tgis_map` (`id_tgis_map` ) - ON DELETE CASCADE - ON UPDATE NO ACTION) + `id_tmap_layer` INT NOT NULL AUTO_INCREMENT COMMENT 'table id' , + `layer_name` VARCHAR(45) NOT NULL COMMENT 'Name of the layer ' , + `view_layer` TINYINT(1) NOT NULL DEFAULT TRUE COMMENT 'True if the layer must be shown' , + `layer_stack_order` TINYINT(3) NULL DEFAULT 0 COMMENT 'Number of order of the layer in the layer stack, bigger means upper on the stack.\n' , + `tgis_map_id_tgis_map` INT NOT NULL COMMENT 'reference to the map containing the layer' , + `tgrupo_id_grupo` MEDIUMINT(4) NOT NULL COMMENT 'reference to the group shown in the layer' , + PRIMARY KEY (`id_tmap_layer`) , + INDEX `fk_tmap_layer_tgis_map1` (`tgis_map_id_tgis_map` ASC) , + CONSTRAINT `fk_tmap_layer_tgis_map1` + FOREIGN KEY (`tgis_map_id_tgis_map` ) + REFERENCES `tgis_map` (`id_tgis_map` ) + ON DELETE CASCADE + ON UPDATE NO ACTION) ENGINE = InnoDB COMMENT = 'Table containing information about the map layers'; @@ -1383,21 +1383,21 @@ COMMENT = 'Table containing information about the map layers'; -- Table `tgis_map_layer_has_tagente` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tgis_map_layer_has_tagente` ( - `tgis_map_layer_id_tmap_layer` INT NOT NULL , - `tagente_id_agente` INT(10) UNSIGNED NOT NULL , - PRIMARY KEY (`tgis_map_layer_id_tmap_layer`, `tagente_id_agente`) , - INDEX `fk_tgis_map_layer_has_tagente_tgis_map_layer1` (`tgis_map_layer_id_tmap_layer` ASC) , - INDEX `fk_tgis_map_layer_has_tagente_tagente1` (`tagente_id_agente` ASC) , - CONSTRAINT `fk_tgis_map_layer_has_tagente_tgis_map_layer1` - FOREIGN KEY (`tgis_map_layer_id_tmap_layer` ) - REFERENCES `tgis_map_layer` (`id_tmap_layer` ) - ON DELETE CASCADE - ON UPDATE NO ACTION, - CONSTRAINT `fk_tgis_map_layer_has_tagente_tagente1` - FOREIGN KEY (`tagente_id_agente` ) - REFERENCES `tagente` (`id_agente` ) - ON DELETE CASCADE - ON UPDATE NO ACTION) + `tgis_map_layer_id_tmap_layer` INT NOT NULL , + `tagente_id_agente` INT(10) UNSIGNED NOT NULL , + PRIMARY KEY (`tgis_map_layer_id_tmap_layer`, `tagente_id_agente`) , + INDEX `fk_tgis_map_layer_has_tagente_tgis_map_layer1` (`tgis_map_layer_id_tmap_layer` ASC) , + INDEX `fk_tgis_map_layer_has_tagente_tagente1` (`tagente_id_agente` ASC) , + CONSTRAINT `fk_tgis_map_layer_has_tagente_tgis_map_layer1` + FOREIGN KEY (`tgis_map_layer_id_tmap_layer` ) + REFERENCES `tgis_map_layer` (`id_tmap_layer` ) + ON DELETE CASCADE + ON UPDATE NO ACTION, + CONSTRAINT `fk_tgis_map_layer_has_tagente_tagente1` + FOREIGN KEY (`tagente_id_agente` ) + REFERENCES `tagente` (`id_agente` ) + ON DELETE CASCADE + ON UPDATE NO ACTION) ENGINE = InnoDB COMMENT = 'Table to define wich agents are shown in a layer'; @@ -1449,6 +1449,8 @@ CREATE TABLE IF NOT EXISTS `tnetwork_map` ( `text_filter` VARCHAR(100) NOT NULL DEFAULT "", `dont_show_subgroups` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, `pandoras_children` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, + `show_groups` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, + `show_modules` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (`id_networkmap`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -1502,10 +1504,10 @@ CREATE TABLE IF NOT EXISTS `ttag` ( -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `ttag_module` ( - `id_tag` int(10) NOT NULL, - `id_agente_modulo` int(10) NOT NULL DEFAULT 0, - PRIMARY KEY (id_tag, id_agente_modulo), - KEY `idx_id_agente_modulo` (`id_agente_modulo`) + `id_tag` int(10) NOT NULL, + `id_agente_modulo` int(10) NOT NULL DEFAULT 0, + PRIMARY KEY (id_tag, id_agente_modulo), + KEY `idx_id_agente_modulo` (`id_agente_modulo`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- @@ -1513,10 +1515,10 @@ CREATE TABLE IF NOT EXISTS `ttag_module` ( -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `ttag_policy_module` ( - `id_tag` int(10) NOT NULL, - `id_policy_module` int(10) NOT NULL DEFAULT 0, - PRIMARY KEY (id_tag, id_policy_module), - KEY `idx_id_policy_module` (`id_policy_module`) + `id_tag` int(10) NOT NULL, + `id_policy_module` int(10) NOT NULL DEFAULT 0, + PRIMARY KEY (id_tag, id_policy_module), + KEY `idx_id_policy_module` (`id_policy_module`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- @@ -1524,10 +1526,10 @@ CREATE TABLE IF NOT EXISTS `ttag_policy_module` ( -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `ttag_event` ( - `id_tag` int(10) NOT NULL, - `id_evento` bigint(20) NOT NULL DEFAULT 0, - PRIMARY KEY (id_tag, id_evento), - KEY `idx_id_evento` (`id_evento`) + `id_tag` int(10) NOT NULL, + `id_evento` bigint(20) NOT NULL DEFAULT 0, + PRIMARY KEY (id_tag, id_evento), + KEY `idx_id_evento` (`id_evento`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- @@ -1535,18 +1537,18 @@ CREATE TABLE IF NOT EXISTS `ttag_event` ( -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tnetflow_filter` ( - `id_sg` int(10) unsigned NOT NULL auto_increment, - `id_name` varchar(600) NOT NULL default '0', - `id_group` int(10), - `ip_dst` TEXT NOT NULL, - `ip_src` TEXT NOT NULL, - `dst_port` TEXT NOT NULL, - `src_port` TEXT NOT NULL, - `advanced_filter` TEXT NOT NULL, - `filter_args` TEXT NOT NULL, - `aggregate` varchar(60), - `output` varchar(60), -PRIMARY KEY (`id_sg`) + `id_sg` int(10) unsigned NOT NULL auto_increment, + `id_name` varchar(600) NOT NULL default '0', + `id_group` int(10), + `ip_dst` TEXT NOT NULL, + `ip_src` TEXT NOT NULL, + `dst_port` TEXT NOT NULL, + `src_port` TEXT NOT NULL, + `advanced_filter` TEXT NOT NULL, + `filter_args` TEXT NOT NULL, + `aggregate` varchar(60), + `output` varchar(60), + PRIMARY KEY (`id_sg`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- @@ -1554,12 +1556,12 @@ PRIMARY KEY (`id_sg`) -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tnetflow_report` ( - `id_report` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - `id_name` varchar(150) NOT NULL default '', - `description` TEXT NOT NULL, - `id_group` int(10), - `server_name` TEXT NOT NULL, -PRIMARY KEY(`id_report`) + `id_report` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `id_name` varchar(150) NOT NULL default '', + `description` TEXT NOT NULL, + `id_group` int(10), + `server_name` TEXT NOT NULL, + PRIMARY KEY(`id_report`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- --------------------------------------------------------------------- @@ -1567,7 +1569,7 @@ PRIMARY KEY(`id_report`) -- --------------------------------------------------------------------- CREATE TABLE IF NOT EXISTS `tnetflow_report_content` ( - `id_rc` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `id_rc` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `id_report` INTEGER UNSIGNED NOT NULL default 0, `id_filter` INTEGER UNSIGNED NOT NULL default 0, `description` TEXT NOT NULL, @@ -1588,34 +1590,34 @@ CREATE TABLE IF NOT EXISTS `tnetflow_report_content` ( -- --------------------------------------------------------------------- CREATE TABLE IF NOT EXISTS `tevent_filter` ( - `id_filter` int(10) unsigned NOT NULL auto_increment, - `id_group_filter` int(10) NOT NULL default 0, - `id_name` varchar(600) NOT NULL, - `id_group` int(10) NOT NULL default 0, - `event_type` text NOT NULL, - `severity` int(10) NOT NULL default -1, - `status` int(10) NOT NULL default -1, - `search` TEXT, - `text_agent` TEXT, - `pagination` int(10) NOT NULL default 25, - `event_view_hr` int(10) NOT NULL default 8, - `id_user_ack` TEXT, - `group_rep` int(10) NOT NULL default 0, - `tag` varchar(600) NOT NULL default '', - `filter_only_alert` int(10) NOT NULL default -1, -PRIMARY KEY (`id_filter`) + `id_filter` int(10) unsigned NOT NULL auto_increment, + `id_group_filter` int(10) NOT NULL default 0, + `id_name` varchar(600) NOT NULL, + `id_group` int(10) NOT NULL default 0, + `event_type` text NOT NULL, + `severity` int(10) NOT NULL default -1, + `status` int(10) NOT NULL default -1, + `search` TEXT, + `text_agent` TEXT, + `pagination` int(10) NOT NULL default 25, + `event_view_hr` int(10) NOT NULL default 8, + `id_user_ack` TEXT, + `group_rep` int(10) NOT NULL default 0, + `tag` varchar(600) NOT NULL default '', + `filter_only_alert` int(10) NOT NULL default -1, + PRIMARY KEY (`id_filter`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- -- Table `tpassword_history` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tpassword_history` ( - `id_pass` int(10) unsigned NOT NULL auto_increment, - `id_user` varchar(60) NOT NULL, - `password` varchar(45) default NULL, - `date_begin` DATETIME NOT NULL DEFAULT 0, - `date_end` DATETIME NOT NULL DEFAULT 0, -PRIMARY KEY (`id_pass`) + `id_pass` int(10) unsigned NOT NULL auto_increment, + `id_user` varchar(60) NOT NULL, + `password` varchar(45) default NULL, + `date_begin` DATETIME NOT NULL DEFAULT 0, + `date_end` DATETIME NOT NULL DEFAULT 0, + PRIMARY KEY (`id_pass`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------------------------------------------------