From b8ce800b7abd33e63b6892db35a337fec7648c97 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Thu, 31 Jan 2013 18:05:22 +0000 Subject: [PATCH] 2013-01-31 Ramon Novoa * extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql, pandoradb.sql: Removed some indexes that caused deadlocks on high load scenarios. * godmode/setup/setup_general.php, include/functions_config.php: Added support for event storm protection. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7557 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 ++++++++++ .../pandoradb_migrate_4.0.x_to_5.0.mysql.sql | 17 +++++++++++++++++ pandora_console/godmode/setup/setup_general.php | 7 +++++++ pandora_console/include/functions_config.php | 7 ++++++- pandora_console/pandoradb.sql | 14 ++++---------- 5 files changed, 44 insertions(+), 11 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 371cf5c13e..e580e5657a 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2013-01-31 Ramon Novoa + + * extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql, + pandoradb.sql: Removed some indexes that caused deadlocks on high + load scenarios. + + * godmode/setup/setup_general.php, + include/functions_config.php: Added support for event storm + protection. + 2013-01-31 Miguel de Dios * godmode/reporting/visual_console_builder.editor.js: fixed a 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 166d9b9962..0063186a3a 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 @@ -1062,3 +1062,20 @@ INSERT INTO `tnetwork_component_group` VALUES (48,'MacOS',0); DROP TABLE IF EXISTS `talert_compound_actions`; DROP TABLE IF EXISTS `talert_compound_elements`; DROP TABLE IF EXISTS `talert_compound`; + +-- --------------------------------------------------------------------- +-- Modify indexes +-- --------------------------------------------------------------------- + +ALTER TABLE tagente_estado DROP INDEX idx_status; +ALTER TABLE tagente_estado DROP INDEX current_interval; +ALTER TABLE tagente_estado DROP INDEX last_execution_try; + +ALTER TABLE tevento DROP INDEX indice_1; +ALTER TABLE tevento DROP INDEX criticity; +ALTER TABLE tevento DROP INDEX estado; +ALTER TABLE tevento ADD INDEX `idx_utimestamp` USING BTREE (`utimestamp`); + +ALTER TABLE tserver DROP INDEX keepalive; +ALTER TABLE tserver DROP INDEX status; + diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index bc1bbcabe7..3fa38f6320 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -225,6 +225,13 @@ $table->data[29][1] = __('Yes') . '   ' . $table->data[29][1] .= __('No') . '   ' . html_print_radio_button ('referer_security', 0, '', $config["referer_security"], true); +$table->data[30][0] = __('Event storm protection'); +$table->data[30][0] .= ui_print_help_tip(__('If set to yes no events or alerts will be generated, but agents will continue receiving data.'), true); +$table->data[30][1] = __('Yes') . '   ' . + html_print_radio_button ('event_storm_protection', 1, '', $config["event_storm_protection"], true) . + '  '; +$table->data[30][1] .= __('No') . '   ' . + html_print_radio_button ('event_storm_protection', 0, '', $config["event_storm_protection"], true); echo '
'; diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 5b3e0caece..b031e7ea95 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -129,6 +129,7 @@ function config_update_config () { } config_update_value ('public_url', get_parameter('public_url')); config_update_value ('referer_security', get_parameter('referer_security')); + config_update_value ('event_storm_protection', get_parameter('event_storm_protection')); break; case 'enterprise': if (isset($config['enterprise_installed']) && $config['enterprise_installed'] == 1) { @@ -845,7 +846,11 @@ function config_process_config () { if (!isset($config['referer_security'])) { config_update_value ('referer_security', 0); } - + + if (!isset($config['event_storm_protection'])) { + config_update_value ('event_storm_protection', 0); + } + /* Finally, check if any value was overwritten in a form */ config_update_config(); } diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 4de1eb2246..4977e213d5 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -157,10 +157,7 @@ CREATE TABLE `tagente_estado` ( PRIMARY KEY (`id_agente_estado`), KEY `status_index_1` (`id_agente_modulo`), KEY `idx_agente` (`id_agente`), - KEY `idx_status` (`estado`), - KEY `current_interval` (`current_interval`), - KEY `running_by` (`running_by`), - KEY `last_execution_try` (`last_execution_try`) + KEY `running_by` (`running_by`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- Probably last_execution_try index is not useful and loads more than benefits @@ -496,10 +493,9 @@ CREATE TABLE IF NOT EXISTS `tevento` ( `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 `idx_agente` (`id_agente`), KEY `idx_agentmodule` (`id_agentmodule`), - INDEX criticity (`criticity`), - INDEX estado (`estado`) + KEY `idx_utimestamp` USING BTREE (`utimestamp`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- Criticity: 0 - Maintance (grey) -- Criticity: 1 - Informational (blue) @@ -793,9 +789,7 @@ CREATE TABLE IF NOT EXISTS `tserver` ( `my_modules` int(11) NOT NULL default 0, `stat_utimestamp` bigint(20) NOT NULL default '0', PRIMARY KEY (`id_server`), - KEY `name` (`name`), - KEY `keepalive` (`keepalive`), - KEY `status` (`status`) + KEY `name` (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- server types: -- 0 data