From 6dfd8974d85a840b6df575523f95ae06e612e286 Mon Sep 17 00:00:00 2001 From: jsatoh Date: Sat, 31 May 2014 13:36:53 +0000 Subject: [PATCH] 2014-05-31 Junichi Satoh * godmode/agentes/configurar_agente.php, godmode/agentes/module_manager_editor.php, godmode/agentes/module_manager_editor_common.php, pandoradb.sql, pandoradb.oracle.sql, pandoradb.postgreSQL.sql, extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql, extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql, extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql: Improved 'FF threshold' to be able to define timeout. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10061 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 +++++++++++ .../pandoradb_migrate_5.0.x_to_5.1.mysql.sql | 8 ++++++++ .../pandoradb_migrate_5.0.x_to_5.1.oracle.sql | 8 ++++++++ ...ndoradb_migrate_5.0.x_to_5.1.postgreSQL.sql | 8 ++++++++ .../godmode/agentes/configurar_agente.php | 3 +++ .../godmode/agentes/module_manager_editor.php | 3 +++ .../agentes/module_manager_editor_common.php | 18 +++++++++++------- pandora_console/pandoradb.oracle.sql | 6 ++++-- pandora_console/pandoradb.postgreSQL.sql | 6 ++++-- pandora_console/pandoradb.sql | 2 ++ 10 files changed, 62 insertions(+), 11 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b2bc924af2..c8687bd806 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2014-05-31 Junichi Satoh + + * godmode/agentes/configurar_agente.php, + godmode/agentes/module_manager_editor.php, + godmode/agentes/module_manager_editor_common.php, + pandoradb.sql, pandoradb.oracle.sql, pandoradb.postgreSQL.sql, + extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql, + extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql, + extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql: Improved + 'FF threshold' to be able to define timeout. + 2014-05-30 Miguel de Dios * operation/events/sound_events.php: fixed the break image. diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql index 44e82412e4..8d851fb1ee 100644 --- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql @@ -54,6 +54,8 @@ ALTER TABLE `tagente_modulo` ADD COLUMN `min_ff_event_normal` int(4) unsigned de ALTER TABLE `tagente_modulo` ADD COLUMN `min_ff_event_warning` int(4) unsigned default '0'; ALTER TABLE `tagente_modulo` ADD COLUMN `min_ff_event_critical` int(4) unsigned default '0'; ALTER TABLE `tagente_modulo` ADD COLUMN `each_ff` tinyint(1) unsigned default '0'; +/* 2014/05/31 */ +ALTER TABLE `tagente_modulo` ADD COLUMN `ff_timeout` int(4) unsigned default '0'; /* 2014/03/18 */ -- --------------------------------------------------------------------- @@ -218,3 +220,9 @@ ALTER TABLE `tnews` ADD COLUMN `id_group` int(10) NOT NULL default 0; ALTER TABLE `tnews` ADD COLUMN `modal` tinyint(1) DEFAULT 0; ALTER TABLE `tnews` ADD COLUMN `expire` tinyint(1) DEFAULT 0; ALTER TABLE `tnews` ADD COLUMN `expire_timestamp` DATETIME NOT NULL DEFAULT 0; + +/* 2014/05/31 */ +-- --------------------------------------------------------------------- +-- Table `tagente_estado` +-- --------------------------------------------------------------------- +ALTER TABLE `tagente_estado` ADD COLUMN `ff_start_utimestamp` bigint(20) default 0; diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql index 0bb7d97e6b..fe37938621 100644 --- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql @@ -46,6 +46,8 @@ ALTER TABLE tagente_modulo ADD COLUMN min_ff_event_normal INTEGER default 0; ALTER TABLE tagente_modulo ADD COLUMN min_ff_event_warning INTEGER default 0; ALTER TABLE tagente_modulo ADD COLUMN min_ff_event_critical INTEGER default 0; ALTER TABLE tagente_modulo ADD COLUMN each_ff NUMBER(1, 0) default 0; +/* 2014/05/31 */ +ALTER TABLE tagente_modulo ADD COLUMN ff_timeout INTEGER unsigned default 0; /* 2014/03/18 */ -- ---------------------------------------------------------------------- @@ -202,3 +204,9 @@ ALTER TABLE tnews ADD COLUMN id_group NUMBER(10, 0) default 0 NOT NULL; ALTER TABLE tnews ADD COLUMN modal NUMBER(5, 0) default 0 NOT NULL; ALTER TABLE tnews ADD COLUMN expire NUMBER(5, 0) default 0 NOT NULL; ALTER TABLE tnews ADD COLUMN expire_timestamp TIMESTAMP default NULL; + +/* 2014/05/31 */ +-- --------------------------------------------------------------------- +-- Table `tagente_estado` +-- --------------------------------------------------------------------- +ALTER TABLE tagente_estado ADD COLUMN ff_start_utimestamp NUMBER(10, 0) default 0; diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql index fd04269970..23a06b9497 100644 --- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql @@ -47,6 +47,8 @@ ALTER TABLE "tagente_modulo" ADD COLUMN "min_ff_event_normal" INTEGER default 0; ALTER TABLE "tagente_modulo" ADD COLUMN "min_ff_event_warning" INTEGER default 0; ALTER TABLE "tagente_modulo" ADD COLUMN "min_ff_event_critical" INTEGER default 0; ALTER TABLE "tagente_modulo" ADD COLUMN "each_ff" SMALLINT default 0; +/* 2014/05/31 */ +ALTER TABLE "tagente_modulo" ADD COLUMN "ff_timeout" INTEGER unsigned default 0; /* 2014/03/18 */ -- ---------------------------------------------------------------------- @@ -176,3 +178,9 @@ ALTER TABLE "tnews" ADD COLUMN "id_group" INTEGER NOT NULL default 0; ALTER TABLE "tnews" ADD COLUMN "modal" SMALLINT DEFAULT 0; ALTER TABLE "tnews" ADD COLUMN "expire" SMALLINT DEFAULT 0; ALTER TABLE "tnews" ADD COLUMN "expire_timestamp" TIMESTAMP without time zone default '1970-01-01 00:00:00'; + +/* 2014/05/31 */ +-- --------------------------------------------------------------------- +-- Table `tagente_estado` +-- --------------------------------------------------------------------- +ALTER TABLE "tagente_estado" ADD COLUMN "ff_start_utimestamp" BIGINT default 0; diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 8f0b28333f..b842141b23 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -919,6 +919,7 @@ if ($update_module || $create_module) { $ff_event_warning = (int) get_parameter ('ff_event_warning'); $ff_event_critical = (int) get_parameter ('ff_event_critical'); $each_ff = (int) get_parameter ('each_ff'); + $ff_timeout = (int) get_parameter ('ff_timeout'); $unit = (string) get_parameter('unit'); $id_tag = (array) get_parameter('id_tag_selected'); $serialize_ops = (string) get_parameter('serialize_ops'); @@ -1008,6 +1009,7 @@ if ($update_module) { 'min_ff_event_warning' => $ff_event_warning, 'min_ff_event_critical' => $ff_event_critical, 'each_ff' => $each_ff, + 'ff_timeout' => $ff_timeout, 'unit' => $unit, 'macros' => $macros, 'quiet' => $quiet_module, @@ -1145,6 +1147,7 @@ if ($create_module) { 'min_ff_event_warning' => $ff_event_warning, 'min_ff_event_critical' => $ff_event_critical, 'each_ff' => $each_ff, + 'ff_timeout' => $ff_timeout, 'unit' => $unit, 'macros' => $macros, 'quiet' => $quiet_module, diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index 9e7b47c201..30c733cca4 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -207,6 +207,7 @@ if ($id_agent_module) { $ff_event_warning = $module['min_ff_event_warning']; $ff_event_critical = $module['min_ff_event_critical']; $each_ff = $module['each_ff']; + $ff_timeout = $module['ff_timeout']; // Select tag info. $id_tag = tags_get_module_tags ($id_agent_module); @@ -311,6 +312,8 @@ else { $wday = '*'; $ff_interval = 0; + + $ff_timeout = 0; $module_macros = array (); } diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index c6bade335b..38cc3d7c93 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -308,9 +308,9 @@ $table_advanced->colspan[1][1] = 2; $table_advanced->data[1][1] = html_print_input_text ('custom_id', $custom_id, '', 20, 65, true); -$table_advanced->data[1][3] = __('FF interval'); -$table_advanced->data[1][4] = html_print_input_text ('module_ff_interval', $ff_interval, - '', 5, 10, true, $disabledBecauseInPolicy).ui_print_help_tip (__('Module execution flip flop time interval (in secs).'), true); +$table_advanced->data[1][3] = __('Unit'); +$table_advanced->data[1][4] = html_print_input_text ('unit', $unit, + '', 20, 65, true); // In the data modules, the interval is not in seconds. It is a factor // to be multiplied for the agent interval @@ -388,10 +388,14 @@ $table_advanced->data[4][3] = __('Throw unknown events'); $table_advanced->data[4][4] = html_print_checkbox('throw_unknown_events', 1, $throw_unknown_events_check, true); -$table_advanced->data[5][0] = __('Unit'); -$table_advanced->data[5][1] = html_print_input_text ('unit', $unit, - '', 20, 65, true); -$table_advanced->colspan[5][1] = 4; +$table_advanced->data[5][0] = __('FF interval'); +$table_advanced->data[5][1] = html_print_input_text ('module_ff_interval', $ff_interval, + '', 5, 10, true, $disabledBecauseInPolicy).ui_print_help_tip (__('Module execution flip flop time interval (in secs).'), true); +$table_advanced->colspan[5][1] = 2; + +$table_advanced->data[5][3] = __('FF timeout'); +$table_advanced->data[5][4] = html_print_input_text ('ff_timeout', $ff_timeout, + '', 5, 10, true, $disabledBecauseInPolicy).ui_print_help_tip (__('Timeout in secs from start of flip flop counting. If this value is exceeded, FF counter is reset. Set to 0 for no timeout.'), true); /* Tags */ // This var comes from module_manager_editor.php or policy_modules.php diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 112a7a2d0c..3774d63326 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -163,7 +163,8 @@ CREATE TABLE tagente_estado ( status_changes NUMBER(10, 0) default 0, last_status NUMBER(10, 0) default 0, last_known_status NUMBER(10, 0) default 0, - last_error NUMBER(10, 0) default 0 + last_error NUMBER(10, 0) default 0, + ff_start_utimestamp 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); @@ -252,7 +253,8 @@ CREATE TABLE tagente_modulo ( min_ff_event_normal INTEGER default 0, min_ff_event_warning INTEGER default 0, min_ff_event_critical INTEGER default 0, - each_ff NUMBER(1, 0) default 0 + each_ff NUMBER(1, 0) default 0, + ff_timeout INTEGER unsigned default 0 CONSTRAINT t_agente_modulo_wizard_level_cons CHECK (wizard_level IN ('basic','advanced','nowizard')) ); diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index ff696c7224..36172261c6 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -156,7 +156,8 @@ CREATE TABLE "tagente_estado" ( "status_changes" INTEGER default 0, "last_status" INTEGER default 0, "last_known_status" INTEGER default 0, - "last_error" INTEGER default 0 + "last_error" INTEGER default 0, + "ff_start_utimestamp" BIGINT 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"); @@ -241,7 +242,8 @@ CREATE TABLE "tagente_modulo" ( "min_ff_event_normal" INTEGER default 0, "min_ff_event_warning" INTEGER default 0, "min_ff_event_critical" INTEGER default 0, - "each_ff" SMALLINT default 0 + "each_ff" SMALLINT default 0, + "ff_timeout" INTEGER unsigned default 0 ); CREATE INDEX "tagente_modulo_id_agente_idx" ON "tagente_modulo"("id_agente"); CREATE INDEX "tagente_modulo_id_tipo_modulo_idx" ON "tagente_modulo"("id_tipo_modulo"); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index e368855976..320e0ff18f 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -154,6 +154,7 @@ CREATE TABLE `tagente_estado` ( `last_status` tinyint(4) default 0, `last_known_status` tinyint(4) default 0, `last_error` int(4) NOT NULL default '0', + `ff_start_utimestamp` bigint(20) default 0, PRIMARY KEY (`id_agente_estado`), KEY `status_index_1` (`id_agente_modulo`), KEY `idx_agente` (`id_agente`), @@ -238,6 +239,7 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` ( `min_ff_event_warning` int(4) unsigned default '0', `min_ff_event_critical` int(4) unsigned default '0', `each_ff` tinyint(1) unsigned default '0', + `ff_timeout` int(4) unsigned default '0', PRIMARY KEY (`id_agente_modulo`), KEY `main_idx` (`id_agente_modulo`,`id_agente`), KEY `tam_agente` (`id_agente`),