From dd54757bd4ed62b4f8f6a73a5780073f7189512c Mon Sep 17 00:00:00 2001 From: jsatoh Date: Wed, 21 May 2014 08:25:10 +0000 Subject: [PATCH] 2014-05-21 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 each state changing. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9973 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 +++++++++ .../pandoradb_migrate_5.0.x_to_5.1.mysql.sql | 5 ++++ .../pandoradb_migrate_5.0.x_to_5.1.oracle.sql | 9 +++++++ ...doradb_migrate_5.0.x_to_5.1.postgreSQL.sql | 9 +++++++ .../godmode/agentes/configurar_agente.php | 12 ++++++++++ .../godmode/agentes/module_manager_editor.php | 4 ++++ .../agentes/module_manager_editor_common.php | 24 +++++++++++++------ pandora_console/pandoradb.oracle.sql | 4 ++++ pandora_console/pandoradb.postgreSQL.sql | 6 ++++- pandora_console/pandoradb.sql | 4 ++++ 10 files changed, 80 insertions(+), 8 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 45db43eaa9..565ce544e0 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2014-05-21 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 each state changing. + 2014-05-20 Vanessa Gil * godmode/gis_maps/configure_gis_map.php: Fixed 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 2f166cab42..0ac4cdfe41 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 @@ -49,6 +49,11 @@ INSERT INTO `tconfig_os` (`name`, `description`, `icon_name`) VALUES ('Satellite -- Table `tagente_modulo` -- --------------------------------------------------------------------- ALTER TABLE `pandora`.`tagente_modulo` MODIFY COLUMN `post_process` DOUBLE DEFAULT NULL; +/* 2014/05/21 */ +ALTER TABLE `tagente_modulo` ADD COLUMN `min_ff_event_normal` int(4) unsigned default '0'; +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/03/18 */ -- --------------------------------------------------------------------- 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 319d9adaab..aac5117f7e 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 @@ -38,6 +38,15 @@ INSERT INTO tconfig_os VALUES (17, 'Router', 'Generic router', 'so_router.png'); INSERT INTO tconfig_os VALUES (18, 'Switch', 'Generic switch', 'so_switch.png'); INSERT INTO tconfig_os VALUES (19, 'Satellite', 'Satellite agent', 'satellite.png'); +-- --------------------------------------------------------------------- +-- Table `tagente_modulo` +-- --------------------------------------------------------------------- +/* 2014/05/21 */ +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/03/18 */ -- ---------------------------------------------------------------------- -- Table `tmodule_relationship` 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 ba270f83c1..518df1dc8c 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 @@ -39,6 +39,15 @@ INSERT INTO "tconfig_os" VALUES (17, 'Router', 'Generic router', 'so_router.png' INSERT INTO "tconfig_os" VALUES (18, 'Switch', 'Generic switch', 'so_switch.png'); INSERT INTO "tconfig_os" VALUES (19, 'Satellite', 'Satellite agent', 'satellite.png'); +-- --------------------------------------------------------------------- +-- Table `tagente_modulo` +-- --------------------------------------------------------------------- +/* 2014/05/21 */ +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/03/18 */ -- ---------------------------------------------------------------------- -- Table `tmodule_relationship` diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 1cb71ec2c0..1282f9ed98 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -915,6 +915,10 @@ if ($update_module || $create_module) { $max_critical = (float) get_parameter ('max_critical'); $str_critical = (string) get_parameter ('str_critical'); $ff_event = (int) get_parameter ('ff_event'); + $ff_event_normal = (int) get_parameter ('ff_event_normal'); + $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'); $unit = (string) get_parameter('unit'); $id_tag = (array) get_parameter('id_tag_selected'); $serialize_ops = (string) get_parameter('serialize_ops'); @@ -1000,6 +1004,10 @@ if ($update_module) { 'custom_integer_1' => $custom_integer_1, 'custom_integer_2' => $custom_integer_2, 'min_ff_event' => $ff_event, + 'min_ff_event_normal' => $ff_event_normal, + 'min_ff_event_warning' => $ff_event_warning, + 'min_ff_event_critical' => $ff_event_critical, + 'each_ff' => $each_ff, 'unit' => $unit, 'macros' => $macros, 'quiet' => $quiet_module, @@ -1133,6 +1141,10 @@ if ($create_module) { 'custom_integer_1' => $custom_integer_1, 'custom_integer_2' => $custom_integer_2, 'min_ff_event' => $ff_event, + 'min_ff_event_normal' => $ff_event_normal, + 'min_ff_event_warning' => $ff_event_warning, + 'min_ff_event_critical' => $ff_event_critical, + 'each_ff' => $each_ff, '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 cc7abb9438..9e7b47c201 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -203,6 +203,10 @@ if ($id_agent_module) { $max_critical = $module['max_critical']; $str_critical = $module['str_critical']; $ff_event = $module['min_ff_event']; + $ff_event_normal = $module['min_ff_event_normal']; + $ff_event_warning = $module['min_ff_event_warning']; + $ff_event_critical = $module['min_ff_event_critical']; + $each_ff = $module['each_ff']; // Select tag info. $id_tag = tags_get_module_tags ($id_agent_module); diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index c78f4033c5..c6bade335b 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -121,7 +121,7 @@ $table_simple->style[0] = 'font-weight: bold; vertical-align: top; width: 26%'; $table_simple->style[1] = 'width: 40%'; $table_simple->style[2] = 'font-weight: bold; vertical-align: top'; -$table_simple->colspan[4][1] = 3; +#$table_simple->colspan[4][1] = 3; $table_simple->colspan[5][1] = 3; $table_simple->colspan[6][1] = 3; @@ -266,16 +266,26 @@ $table_simple->data[2][3] .= html_print_checkbox ("critical_inverse", 1, $critic /* FF stands for Flip-flop */ $table_simple->data[3][0] = __('FF threshold').' ' . ui_print_help_icon ('ff_threshold', true); -$table_simple->data[3][1] = html_print_input_text ('ff_event', $ff_event, - '', 5, 15, true, $disabledBecauseInPolicy); -$table_simple->data[3][2] = __('Historical data'); +$table_simple->colspan[3][1] = 3; + +$table_simple->data[3][1] = html_print_radio_button ('each_ff', 0, '', $each_ff, true) . ' ' . __('All state changing') . ' : '; +$table_simple->data[3][1] .= html_print_input_text ('ff_event', $ff_event, '', 5 +, 15, true, $disabledBecauseInPolicy) . '
'; +$table_simple->data[3][1] .= html_print_radio_button ('each_ff', 1, '', $each_ff, true) . ' ' . __('Each state changing') . ' : '; +$table_simple->data[3][1] .= __('To normal'); +$table_simple->data[3][1] .= html_print_input_text ('ff_event_normal', $ff_event_normal, '', 5, 15, true, $disabledBecauseInPolicy) . ' '; +$table_simple->data[3][1] .= __('To warning'); +$table_simple->data[3][1] .= html_print_input_text ('ff_event_warning', $ff_event_warning, '', 5, 15, true, $disabledBecauseInPolicy) . ' '; +$table_simple->data[3][1] .= __('To critical'); +$table_simple->data[3][1] .= html_print_input_text ('ff_event_critical', $ff_event_critical, '', 5, 15, true, $disabledBecauseInPolicy); +$table_simple->data[4][0] = __('Historical data'); if($disabledBecauseInPolicy) { // If is disabled, we send a hidden in his place and print a false checkbox because HTML dont send disabled fields and could be disabled by error - $table_simple->data[3][3] = html_print_checkbox ("history_data_fake", 1, $history_data, true, $disabledBecauseInPolicy); - $table_simple->data[3][3] .= ''; + $table_simple->data[4][1] = html_print_checkbox ("history_data_fake", 1, $history_data, true, $disabledBecauseInPolicy); + $table_simple->data[4][1] .= ''; } else { - $table_simple->data[3][3] = html_print_checkbox ("history_data", 1, $history_data, true, $disabledBecauseInPolicy); + $table_simple->data[4][1] = html_print_checkbox ("history_data", 1, $history_data, true, $disabledBecauseInPolicy); } /* Advanced form part */ diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 69cc8030bf..81600c3dea 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -249,6 +249,10 @@ CREATE TABLE tagente_modulo ( id_category NUMBER(10, 0) default 0 NOT NULL, disabled_types_event CLOB default '', module_macros CLOB default '', + 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 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 538b78cb7f..3875a93261 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -237,7 +237,11 @@ CREATE TABLE "tagente_modulo" ( "warning_inverse" SMALLINT NOT NULL default 0, "id_category" INTEGER NOT NULL default 0, "disabled_types_event" TEXT default '', - "module_macros" TEXT default '' + "module_macros" TEXT default '', + "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 ); 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 7064bad23a..6b08df2053 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -234,6 +234,10 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` ( `id_category` int(10) default 0, `disabled_types_event` TEXT NOT NULL, `module_macros` TEXT NOT NULL, + `min_ff_event_normal` int(4) unsigned default '0', + `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', PRIMARY KEY (`id_agente_modulo`), KEY `main_idx` (`id_agente_modulo`,`id_agente`), KEY `tam_agente` (`id_agente`),