From 57cc4f774f2af855bc8390075638018c963e992c Mon Sep 17 00:00:00 2001 From: jsatoh Date: Sun, 25 May 2014 07:55:26 +0000 Subject: [PATCH] 2014-05-25 Junichi Satoh * godmode/modules/manage_network_components.php, godmode/modules/manage_network_components_form.php godmode/modules/manage_network_components_form_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 for network components. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10003 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 12 +++++ .../pandoradb_migrate_5.0.x_to_5.1.mysql.sql | 9 ++++ .../pandoradb_migrate_5.0.x_to_5.1.oracle.sql | 9 ++++ ...doradb_migrate_5.0.x_to_5.1.postgreSQL.sql | 9 ++++ .../modules/manage_network_components.php | 22 ++++++-- .../manage_network_components_form.php | 12 +++++ .../manage_network_components_form_common.php | 54 +++++++++++-------- pandora_console/pandoradb.oracle.sql | 4 ++ pandora_console/pandoradb.postgreSQL.sql | 6 ++- pandora_console/pandoradb.sql | 4 ++ 10 files changed, 115 insertions(+), 26 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index f128637d09..299a4084a8 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2014-05-25 Junichi Satoh + + * godmode/modules/manage_network_components.php, + godmode/modules/manage_network_components_form.php + godmode/modules/manage_network_components_form_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 for + network components. + 2014-05-25 Junichi Satoh * godmode/massive/massive_edit_modules.php: Improved to support 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 0ac4cdfe41..1791f7120b 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 @@ -199,3 +199,12 @@ DELETE FROM `tnetwork_profile_component` WHERE `id_np`=4; DELETE FROM `tnetwork_profile_component` WHERE `id_np`=5; DELETE FROM `tnetwork_profile_component` WHERE `id_np`=6; DELETE FROM `tnetwork_profile_component` WHERE `id_nc`=24 AND `id_np`=3; + +/* 2014/05/25 */ +-- --------------------------------------------------------------------- +-- Table `tnetwork_component` +-- --------------------------------------------------------------------- +ALTER TABLE `tnetwork_component` ADD COLUMN `min_ff_event_normal` int(4) unsigned default '0'; +ALTER TABLE `tnetwork_component` ADD COLUMN `min_ff_event_warning` int(4) unsigned default '0'; +ALTER TABLE `tnetwork_component` ADD COLUMN `min_ff_event_critical` int(4) unsigned default '0'; +ALTER TABLE `tnetwork_component` ADD COLUMN `each_ff` tinyint(1) unsigned 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 aac5117f7e..9eacb584ad 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 @@ -183,3 +183,12 @@ DELETE FROM tnetwork_profile_component WHERE id_np=4; DELETE FROM tnetwork_profile_component WHERE id_np=5; DELETE FROM tnetwork_profile_component WHERE id_np=6; DELETE FROM tnetwork_profile_component WHERE id_nc=24 AND id_np=3; + +/* 2014/05/25 */ +-- --------------------------------------------------------------------- +-- Table `tnetwork_component` +-- --------------------------------------------------------------------- +ALTER TABLE tnetwork_component ADD COLUMN min_ff_event_normal INTEGER default 0; +ALTER TABLE tnetwork_component ADD COLUMN min_ff_event_warning INTEGER default 0; +ALTER TABLE tnetwork_component ADD COLUMN min_ff_event_critical INTEGER default 0; +ALTER TABLE tnetwork_component ADD COLUMN each_ff NUMBER(1, 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 518df1dc8c..c0355a0457 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 @@ -157,3 +157,12 @@ DELETE FROM "tnetwork_profile_component" WHERE "id_np"=4; DELETE FROM "tnetwork_profile_component" WHERE "id_np"=5; DELETE FROM "tnetwork_profile_component" WHERE "id_np"=6; DELETE FROM "tnetwork_profile_component" WHERE "id_nc"=24 AND "id_np"=3; + +/* 2014/05/25 */ +-- --------------------------------------------------------------------- +-- Table `tnetwork_component` +-- --------------------------------------------------------------------- +ALTER TABLE "tnetwork_component" ADD COLUMN "min_ff_event_normal" INTEGER default 0; +ALTER TABLE "tnetwork_component" ADD COLUMN "min_ff_event_warning" INTEGER default 0; +ALTER TABLE "tnetwork_component" ADD COLUMN "min_ff_event_critical" INTEGER default 0; +ALTER TABLE "tnetwork_component" ADD COLUMN "each_ff" SMALLINT default 0; diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index 88bc324982..3cafe9fcdf 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -97,6 +97,10 @@ $warning_inverse = (int) get_parameter('warning_inverse'); $id_category = (int) get_parameter('id_category'); $id_tag_selected = (array) get_parameter('id_tag_selected'); $pure = get_parameter('pure', 0); +$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'); if (count($id_tag_selected) == 1 && empty($id_tag_selected[0])) { $tags = ''; @@ -214,7 +218,11 @@ if ($create_component) { 'warning_inverse' => $warning_inverse, 'id_category' => $id_category, 'tags' => $tags, - 'disabled_types_event' => $disabled_types_event)); + 'disabled_types_event' => $disabled_types_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)); } else { $id = ''; @@ -296,7 +304,11 @@ if ($update_component) { 'warning_inverse' => $warning_inverse, 'id_category' => $id_category, 'tags' => $tags, - 'disabled_types_event' => $disabled_types_event)); + 'disabled_types_event' => $disabled_types_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)); } else { $result = ''; @@ -413,7 +425,11 @@ $url = ui_get_url_refresh (array ('offset' => false, 'critical_inverse' => false, 'warning_inverse' => false, 'id_category' => false, - 'tags' => false)); + 'tags' => false, + 'ff_event_normal' => false, + 'ff_event_warning' => false, + 'ff_event_critical' => false, + 'each_ff' => false)); $search_id_group = (int) get_parameter ('search_id_group'); diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index 1113937707..a8ee3acab7 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -70,6 +70,10 @@ if ($create_network_from_module) { $critical_inverse = $data_module["critical_inverse"]; $warning_inverse = $data_module["warning_inverse"]; $id_category = $data_module["id_category"]; + $ff_event_normal = $data_module["min_ff_event_normal"]; + $ff_event_warning = $data_module["min_ff_event_warning"]; + $ff_event_critical = $data_module["min_ff_event_critical"]; + $each_ff = $data_module["each_ff"]; } $id_component_type = (int) get_parameter ('id_component_type'); @@ -120,6 +124,10 @@ if (isset ($id)) { $warning_inverse = $component["warning_inverse"]; $id_category = $component["id_category"]; $tags = $component["tags"]; + $ff_event_normal = $component["min_ff_event_normal"]; + $ff_event_warning = $component["min_ff_event_warning"]; + $ff_event_critical = $component["min_ff_event_critical"]; + $each_ff = $component["each_ff"]; if ($type >= 15 && $type <= 18) { // New support for snmp v3 @@ -168,6 +176,10 @@ if (isset ($id)) { $warning_inverse = 0; $id_category = 0; $tags = ''; + $ff_event_normal = 0; + $ff_event_warning = 0; + $ff_event_critical = 0; + $each_ff = 0; $snmp_version = 1; $snmp3_auth_user = ''; diff --git a/pandora_console/godmode/modules/manage_network_components_form_common.php b/pandora_console/godmode/modules/manage_network_components_form_common.php index 17e3c1ebb2..3272915f79 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_common.php +++ b/pandora_console/godmode/modules/manage_network_components_form_common.php @@ -130,35 +130,45 @@ $table->data[3][3] .= '
'.__('Inverse interval').''; $table->data[3][3] .= html_print_checkbox ("critical_inverse", 1, $critical_inverse, true); $table->data[4][0] = __('FF threshold') . ' ' . ui_print_help_icon ('ff_threshold', true); -$table->data[4][1] = html_print_input_text ('ff_event', $ff_event, - '', 5, 15, true); -$table->data[4][2] = __('Historical data'); -$table->data[4][3] = html_print_checkbox ("history_data", 1, $history_data, true); +$table->colspan[4][1] = 3; +$table->data[4][1] = html_print_radio_button ('each_ff', 0, '', $each_ff, true) . ' ' . __('All state changing') . ' : '; +$table->data[4][1] .= html_print_input_text ('ff_event', $ff_event, + '', 5, 15, true) . '
'; +$table->data[4][1] .= html_print_radio_button ('each_ff', 1, '', $each_ff, true) . ' ' . __('Each state changing') . ' : '; +$table->data[4][1] .= __('To normal'); +$table->data[4][1] .= html_print_input_text ('ff_event_normal', $ff_event_normal, '', 5, 15, true, $disabledBecauseInPolicy) . ' '; +$table->data[4][1] .= __('To warning'); +$table->data[4][1] .= html_print_input_text ('ff_event_warning', $ff_event_warning, '', 5, 15, true, $disabledBecauseInPolicy) . ' '; +$table->data[4][1] .= __('To critical'); +$table->data[4][1] .= html_print_input_text ('ff_event_critical', $ff_event_critical, '', 5, 15, true, $disabledBecauseInPolicy); -$table->data[5][0] = __('Min. Value'); -$table->data[5][1] = html_print_input_text ('min', $min, '', 5, 15, true). ' ' . ui_print_help_tip (__('Any value below this number is discarted'), true); -$table->data[5][2] = __('Max. Value'); -$table->data[5][3] = html_print_input_text ('max', $max, '', 5, 15, true) . ' ' . ui_print_help_tip (__('Any value over this number is discarted'), true); -$table->data[6][0] = __('Unit'); -$table->data[6][1] = html_print_input_text ('unit', $unit, '', 12, 25, true); +$table->data[5][0] = __('Historical data'); +$table->data[5][1] = html_print_checkbox ("history_data", 1, $history_data, true); -$table->data[6][2] = __('Throw unknown events'); -$table->data[6][3] = html_print_checkbox('throw_unknown_events', 1, +$table->data[6][0] = __('Min. Value'); +$table->data[6][1] = html_print_input_text ('min', $min, '', 5, 15, true). ' ' . ui_print_help_tip (__('Any value below this number is discarted'), true); +$table->data[6][2] = __('Max. Value'); +$table->data[6][3] = html_print_input_text ('max', $max, '', 5, 15, true) . ' ' . ui_print_help_tip (__('Any value over this number is discarted'), true); +$table->data[7][0] = __('Unit'); +$table->data[7][1] = html_print_input_text ('unit', $unit, '', 12, 25, true); + +$table->data[7][2] = __('Throw unknown events'); +$table->data[7][3] = html_print_checkbox('throw_unknown_events', 1, !network_components_is_disable_type_event($id, EVENTS_GOING_UNKNOWN), true); -$table->data[7][0] = __('Critical instructions'). ui_print_help_tip(__("Instructions when the status is critical"), true); -$table->data[7][1] = html_print_textarea ('critical_instructions', 2, 65, $critical_instructions, '', true); -$table->colspan[7][1] = 3; - -$table->data[8][0] = __('Warning instructions'). ui_print_help_tip(__("Instructions when the status is warning"), true); -$table->data[8][1] = html_print_textarea ('warning_instructions', 2, 65, $warning_instructions, '', true); +$table->data[8][0] = __('Critical instructions'). ui_print_help_tip(__("Instructions when the status is critical"), true); +$table->data[8][1] = html_print_textarea ('critical_instructions', 2, 65, $critical_instructions, '', true); $table->colspan[8][1] = 3; -$table->data[9][0] = __('Unknown instructions'). ui_print_help_tip(__("Instructions when the status is unknown"), true); -$table->data[9][1] = html_print_textarea ('unknown_instructions', 2, 65, $unknown_instructions, '', true); +$table->data[9][0] = __('Warning instructions'). ui_print_help_tip(__("Instructions when the status is warning"), true); +$table->data[9][1] = html_print_textarea ('warning_instructions', 2, 65, $warning_instructions, '', true); $table->colspan[9][1] = 3; -$next_row = 10; +$table->data[10][0] = __('Unknown instructions'). ui_print_help_tip(__("Instructions when the status is unknown"), true); +$table->data[10][1] = html_print_textarea ('unknown_instructions', 2, 65, $unknown_instructions, '', true); +$table->colspan[10][1] = 3; + +$next_row = 11; if (check_acl ($config['id_user'], 0, "PM")) { $table->data[$next_row][0] = __('Category'); @@ -168,7 +178,7 @@ if (check_acl ($config['id_user'], 0, "PM")) { } else { // Store in a hidden field if is not visible to avoid delete the value - $table->data[9][1] .= html_print_input_hidden ('id_category', $id_category, true); + $table->data[10][1] .= html_print_input_hidden ('id_category', $id_category, true); } $table->data[$next_row][0] = __('Tags'); diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 81600c3dea..bd5bf808cd 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -770,6 +770,10 @@ CREATE TABLE tnetwork_component ( tags CLOB, 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_network_component_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 3875a93261..5ee9a1c426 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -660,7 +660,11 @@ CREATE TABLE "tnetwork_component" ( "id_category" INTEGER NOT NULL default 0, "tags" text NOT NULL, "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 ); -- --------------------------------------------------------------------- diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 6b08df2053..6f0c4d6523 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -718,6 +718,10 @@ CREATE TABLE IF NOT EXISTS `tnetwork_component` ( `tags` text NOT NULL, `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_nc`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;