From d5d1727fe79b65a7aa93235179813dee3bc80d45 Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 14 Oct 2016 10:16:21 +0200 Subject: [PATCH] add new field for modules --- .../extensions/plugin_registration.php | 4 + .../extensions/resource_registration.php | 16 +++ .../pandoradb_migrate_6.0_to_6.1.mysql.sql | 15 ++ .../pandoradb_migrate_6.0_to_6.1.oracle.sql | 18 +++ ...andoradb_migrate_6.0_to_6.1.postgreSQL.sql | 18 +++ .../godmode/agentes/agent_template.php | 4 + .../godmode/agentes/configurar_agente.php | 12 ++ .../godmode/agentes/module_manager_editor.php | 8 ++ .../agentes/module_manager_editor_common.php | 107 +++++++++----- .../godmode/massive/massive_edit_modules.php | 55 ++++++- .../modules/manage_network_components.php | 16 +++ .../manage_network_components_form.php | 12 ++ .../manage_network_components_form_common.php | 135 +++++++++++------- .../modules/manage_network_templates.php | 2 +- pandora_console/include/functions_html.php | 11 +- .../include/functions_network_components.php | 4 + .../include/javascript/pandora_modules.js | 23 +++ pandora_console/include/styles/pandora.css | 4 + pandora_console/pandoradb.oracle.sql | 7 + pandora_console/pandoradb.postgreSQL.sql | 18 ++- pandora_console/pandoradb.sql | 5 + 21 files changed, 397 insertions(+), 97 deletions(-) diff --git a/pandora_console/extensions/plugin_registration.php b/pandora_console/extensions/plugin_registration.php index 884f9ab689..8807fbe153 100644 --- a/pandora_console/extensions/plugin_registration.php +++ b/pandora_console/extensions/plugin_registration.php @@ -325,6 +325,10 @@ function pluginreg_extension_main () { 'unit' => io_safe_input ($unit), 'max_timeout' => isset($ini_array[$label]["max_timeout"]) ? $ini_array[$label]["max_timeout"] : '', 'history_data' => isset($ini_array[$label]["history_data"]) ? $ini_array[$label]["history_data"] : '', + 'dynamic_interval' => isset($ini_array[$label]["dynamic_interval"]) ? $ini_array[$label]["dynamic_interval"] : '', + 'dynamic_min' => isset($ini_array[$label]["dynamic_min"]) ? $ini_array[$label]["dynamic_min"] : '', + 'dynamic_max' => isset($ini_array[$label]["dynamic_max"]) ? $ini_array[$label]["dynamic_max"] : '', + 'dynamic_two_tailed' => isset($ini_array[$label]["dynamic_two_tailed"]) ? $ini_array[$label]["dynamic_two_tailed"] : '', 'min_warning' => isset($ini_array[$label]["min_warning"]) ? $ini_array[$label]["min_warning"] : '', 'max_warning' => isset($ini_array[$label]["max_warning"]) ? $ini_array[$label]["max_warning"] : '', 'str_warning' => isset($ini_array[$label]["str_warning"]) ? $ini_array[$label]["str_warning"] : '', diff --git a/pandora_console/extensions/resource_registration.php b/pandora_console/extensions/resource_registration.php index e429acd1af..7920efed80 100755 --- a/pandora_console/extensions/resource_registration.php +++ b/pandora_console/extensions/resource_registration.php @@ -608,6 +608,10 @@ function process_upload_xml_component($xml) { $max_timeout = (int)$componentElement->max_timeout; $max_retries = (int)$componentElement->max_retries; $historical_data = (int)$componentElement->historical_data; + $dynamic_interval = (int)$componentElement->dynamic_interval; + $dynamic_min = (int)$componentElement->dynamic_min; + $dynamic_max = (int)$componentElement->dynamic_max; + $dynamic_two_tailed = (int)$componentElement->dynamic_two_tailed; $min_war = (float)$componentElement->min_war; $max_war = (float)$componentElement->max_war; $str_war = (string)$componentElement->str_war; @@ -680,6 +684,10 @@ function process_upload_xml_component($xml) { 'max_timeout' => $max_timeout, 'max_retries' => $max_retries, 'history_data' => $historical_data, + 'dynamic_interval' => $dynamic_interval, + 'dynamic_min' => $dynamic_min, + 'dynamic_max' => $dynamic_max, + 'dynamic_two_tailed' => $dynamic_two_tailed, 'min_warning' => $min_war, 'max_warning' => $max_war, 'str_warning' => $str_war, @@ -716,6 +724,10 @@ function process_upload_xml_component($xml) { 'max_timeout' => $max_timeout, 'max_retries' => $max_retries, 'history_data' => $historical_data, + 'dynamic_interval' => $dynamic_interval, + 'dynamic_min' => $dynamic_min, + 'dynamic_max' => $dynamic_max, + 'dynamic_two_tailed' => $dynamic_two_tailed, 'min_warning' => $min_war, 'max_warning' => $max_war, 'str_warning' => $str_war, @@ -754,6 +766,10 @@ function process_upload_xml_component($xml) { 'max_timeout' => $max_timeout, 'max_retries' => $max_retries, 'history_data' => $historical_data, + 'dynamic_interval' => $dynamic_interval, + 'dynamic_min' => $dynamic_min, + 'dynamic_max' => $dynamic_max, + 'dynamic_two_tailed' => $dynamic_two_tailed, 'min_warning' => $min_war, 'max_warning' => $max_war, 'str_warning' => $str_war, diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql index 899243a21a..253def1aa2 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql @@ -68,3 +68,18 @@ ALTER TABLE tevent_filter ADD COLUMN `date_to` date DEFAULT NULL; -- --------------------------------------------------------------------- ALTER TABLE tusuario ADD (`id_filter` int(10) unsigned NULL default NULL); ALTER TABLE tusuario ADD CONSTRAINT fk_id_filter FOREIGN KEY (id_filter) REFERENCES tevent_filter(id_filter) ON DELETE SET NULL; + +-- --------------------------------------------------------------------- +-- Table `tagente_modulo` +-- --------------------------------------------------------------------- +ALTER TABLE tagente_modulo ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; +ALTER TABLE tagente_modulo ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; + +-- --------------------------------------------------------------------- +-- Table `tnetwork_component` +-- --------------------------------------------------------------------- +ALTER TABLE tnetwork_component ADD COLUMN `dynamic_interval` int(4) unsigned default '0'; +ALTER TABLE tnetwork_component ADD COLUMN `dynamic_max` int(4) default '0'; +ALTER TABLE tnetwork_component ADD COLUMN `dynamic_min` int(4) default '0'; +ALTER TABLE tnetwork_component ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; +ALTER TABLE tnetwork_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.oracle.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.oracle.sql index 88d9dd5838..51c82229be 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.oracle.sql @@ -67,3 +67,21 @@ ALTER TABLE tevent_filter ADD COLUMN date_to date DEFAULT NULL; -- --------------------------------------------------------------------- ALTER TABLE tusuario ADD (id_filter int(10) unsigned NULL default NULL); ALTER TABLE tusuario ADD CONSTRAINT fk_id_filter FOREIGN KEY (id_filter) REFERENCES tevent_filter(id_filter) ON DELETE SET NULL; + +-- --------------------------------------------------------------------- +-- Table `tagente_modulo` +-- --------------------------------------------------------------------- +ALTER TABLE tagente_modulo ADD COLUMN dynamic_interval int(4) unsigned default '0'; +ALTER TABLE tagente_modulo ADD COLUMN dynamic_max bigint(20) default '0'; +ALTER TABLE tagente_modulo ADD COLUMN dynamic_min bigint(20) default '0'; +ALTER TABLE tagente_modulo ADD COLUMN dynamic_next bigint(20) NOT NULL default '0'; +ALTER TABLE tagente_modulo ADD COLUMN dynamic_two_tailed tinyint(1) unsigned default '0'; + +-- --------------------------------------------------------------------- +-- Table `tnetwork_component` +-- --------------------------------------------------------------------- +ALTER TABLE tnetwork_component ADD COLUMN dynamic_interval int(4) unsigned default '0'; +ALTER TABLE tnetwork_component ADD COLUMN dynamic_max int(4) default '0'; +ALTER TABLE tnetwork_component ADD COLUMN dynamic_min int(4) default '0'; +ALTER TABLE tnetwork_component ADD COLUMN dynamic_next bigint(20) NOT NULL default '0'; +ALTER TABLE tnetwork_component ADD COLUMN dynamic_two_tailed tinyint(1) unsigned default '0'; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.postgreSQL.sql index 8cd1db8934..e91a0f6f67 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.postgreSQL.sql @@ -4,3 +4,21 @@ ALTER TABLE tagente_estado RENAME COLUMN last_known_status TO known_status; ALTER TABLE tagente_estado ADD COLUMN last_known_status NUMBER(10, 0) DEFAULT 0; + +-- --------------------------------------------------------------------- +-- Table `tagente_modulo` +-- --------------------------------------------------------------------- +ALTER TABLE tagente_modulo ADD COLUMN dynamic_interval int(4) unsigned default 0; +ALTER TABLE tagente_modulo ADD COLUMN dynamic_max bigint(20) default 0; +ALTER TABLE tagente_modulo ADD COLUMN dynamic_min bigint(20) default 0; +ALTER TABLE tagente_modulo ADD COLUMN dynamic_next bigint(20) NOT NULL default 0; +ALTER TABLE tagente_modulo ADD COLUMN dynamic_two_tailed tinyint(1) unsigned default 0; + +-- --------------------------------------------------------------------- +-- Table `tnetwork_component` +-- --------------------------------------------------------------------- +ALTER TABLE tnetwork_component ADD COLUMN dynamic_interval int(4) unsigned default 0; +ALTER TABLE tnetwork_component ADD COLUMN dynamic_max int(4) default 0; +ALTER TABLE tnetwork_component ADD COLUMN dynamic_min int(4) default 0; +ALTER TABLE tnetwork_component ADD COLUMN dynamic_next bigint(20) NOT NULL default 0; +ALTER TABLE tnetwork_component ADD COLUMN dynamic_two_tailed tinyint(1) unsigned default 0; \ No newline at end of file diff --git a/pandora_console/godmode/agentes/agent_template.php b/pandora_console/godmode/agentes/agent_template.php index 000ee06c7f..3ebd4d7c1d 100644 --- a/pandora_console/godmode/agentes/agent_template.php +++ b/pandora_console/godmode/agentes/agent_template.php @@ -85,6 +85,10 @@ if (isset ($_POST["template_id"])) { 'max_retries' => $row2["max_retries"], 'id_plugin' => $row2['id_plugin'], 'post_process' => $row2['post_process'], + 'dynamic_interval' => $row2['dynamic_interval'], + 'dynamic_max' => $row2['dynamic_max'], + 'dynamic_min' => $row2['dynamic_min'], + 'dynamic_two_tailed' => $row2['dynamic_two_tailed'], 'min_warning' => $row2['min_warning'], 'max_warning' => $row2['max_warning'], 'str_warning' => $row2['str_warning'], diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 4f526745ed..17e5839131 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -975,6 +975,10 @@ if ($update_module || $create_module) { $ip_target = (string) get_parameter ('ip_target'); $custom_id = (string) get_parameter ('custom_id'); $history_data = (int) get_parameter('history_data'); + $dynamic_interval = (int) get_parameter('dynamic_interval'); + $dynamic_max = (int) get_parameter('dynamic_max'); + $dynamic_min = (int) get_parameter('dynamic_min'); + $dynamic_two_tailed = (int) get_parameter('dynamic_two_tailed'); $min_warning = (float) get_parameter ('min_warning'); $max_warning = (float) get_parameter ('max_warning'); $str_warning = (string) get_parameter ('str_warning'); @@ -1069,6 +1073,10 @@ if ($update_module) { 'max_retries' => $max_retries, 'custom_id' => $custom_id, 'history_data' => $history_data, + 'dynamic_interval' => $dynamic_interval, + 'dynamic_max' => $dynamic_max, + 'dynamic_min' => $dynamic_min, + 'dynamic_two_tailed' => $dynamic_two_tailed, 'min_warning' => $min_warning, 'max_warning' => $max_warning, 'str_warning' => $str_warning, @@ -1212,6 +1220,10 @@ if ($create_module) { 'id_modulo' => $id_module, 'custom_id' => $custom_id, 'history_data' => $history_data, + 'dynamic_interval' => $dynamic_interval, + 'dynamic_max' => $dynamic_max, + 'dynamic_min' => $dynamic_min, + 'dynamic_two_tailed' => $dynamic_two_tailed, 'min_warning' => $min_warning, 'max_warning' => $max_warning, 'str_warning' => $str_warning, diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index 14d7e8ed77..be18fe2e5f 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -198,6 +198,10 @@ if ($id_agent_module) { $max_retries = $module['max_retries']; $custom_id = $module['custom_id']; $history_data = $module['history_data']; + $dynamic_interval = $module['dynamic_interval']; + $dynamic_max = $module['dynamic_max']; + $dynamic_min = $module['dynamic_min']; + $dynamic_two_tailed = $module['dynamic_two_tailed']; $min_warning = $module['min_warning']; $max_warning = $module['max_warning']; $str_warning = $module['str_warning']; @@ -280,6 +284,10 @@ else { $plugin_parameter = ''; $custom_id = ''; $history_data = 1; + $dynamic_interval = 0; + $dynamic_min = 0; + $dynamic_max = 0; + $dynamic_two_tailed = 0; $min_warning = 0; $max_warning = 0; $str_warning = ''; diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index dbed05c160..f7bf1800d5 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -228,70 +228,78 @@ $table_simple->data[1][3] = html_print_select_from_sql ('SELECT id_mg, name FROM if($disabledBecauseInPolicy){ $table_simple->data[1][3] .= html_print_input_hidden ('id_module_group', $id_module_group, true); } +$table_simple->data[2][0] = __('Dynamic Interval') .' ' . ui_print_help_icon ('warning_status', true); +html_debug_print($dynamic_interval); +$table_simple->data[2][1] = html_print_extended_select_for_time ('dynamic_interval', $dynamic_interval, '', 'None', '0', 10, true, 'width:150px',false); +$table_simple->data[2][2] = ''.__('Dynamic Min. ').''; +$table_simple->data[2][2] .= html_print_input_text ('dynamic_min', $dynamic_min, '', 10, 255, true); +$table_simple->data[2][2] .= '
'.__('Dynamic Max.').''; +$table_simple->data[2][2] .= html_print_input_text ('dynamic_max', $dynamic_max, '', 10, 255, true); +$table_simple->data[2][3] = ''.__('Dynamic Two Tailed: ').''; +$table_simple->data[2][3] .= html_print_checkbox ("dynamic_two_tailed", 1, $dynamic_two_tailed, true); +$table_simple->data[3][0] = __('Warning status').' ' . ui_print_help_icon ('warning_status', true); -$table_simple->data[2][0] = __('Warning status').' ' . ui_print_help_icon ('warning_status', true); - -$table_simple->data[2][1] = ''; +$table_simple->data[3][1] = ''; if (!modules_is_string_type($id_module_type) || $edit) { - $table_simple->data[2][1] .= ''.__('Min. ').''; - $table_simple->data[2][1] .= html_print_input_text ('min_warning', $min_warning, + $table_simple->data[3][1] .= ''.__('Min. ').''; + $table_simple->data[3][1] .= html_print_input_text ('min_warning', $min_warning, '', 10, 255, true, $disabledBecauseInPolicy); - $table_simple->data[2][1] .= '
'.__('Max.').''; - $table_simple->data[2][1] .= html_print_input_text ('max_warning', $max_warning, + $table_simple->data[3][1] .= '
'.__('Max.').''; + $table_simple->data[3][1] .= html_print_input_text ('max_warning', $max_warning, '', 10, 255, true, $disabledBecauseInPolicy).'
'; } if (modules_is_string_type($id_module_type) || $edit) { - $table_simple->data[2][1] .= ''.__('Str.').''; - $table_simple->data[2][1] .= html_print_input_text ('str_warning', $str_warning, + $table_simple->data[3][1] .= ''.__('Str.').''; + $table_simple->data[3][1] .= html_print_input_text ('str_warning', $str_warning, '', 10, 255, true, $disabledBecauseInPolicy).''; } -$table_simple->data[2][1] .= '
'.__('Inverse interval').''; -$table_simple->data[2][1] .= html_print_checkbox ("warning_inverse", 1, +$table_simple->data[3][1] .= '
'.__('Inverse interval').''; +$table_simple->data[3][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true); -$table_simple->data[2][2] = __('Critical status').' ' . ui_print_help_icon ('critical_status', true); -$table_simple->data[2][3] = ''; +$table_simple->data[3][2] = __('Critical status').' ' . ui_print_help_icon ('critical_status', true); +$table_simple->data[3][3] = ''; if (!modules_is_string_type($id_module_type) || $edit) { - $table_simple->data[2][3] .= ''.__('Min. ').''; - $table_simple->data[2][3] .= html_print_input_text ('min_critical', $min_critical, + $table_simple->data[3][3] .= ''.__('Min. ').''; + $table_simple->data[3][3] .= html_print_input_text ('min_critical', $min_critical, '', 10, 255, true, $disabledBecauseInPolicy); - $table_simple->data[2][3] .= '
'.__('Max.').''; - $table_simple->data[2][3] .= html_print_input_text ('max_critical', $max_critical, + $table_simple->data[3][3] .= '
'.__('Max.').''; + $table_simple->data[3][3] .= html_print_input_text ('max_critical', $max_critical, '', 10, 255, true, $disabledBecauseInPolicy).'
'; } if (modules_is_string_type($id_module_type) || $edit) { - $table_simple->data[2][3] .= ''.__('Str.').''; - $table_simple->data[2][3] .= html_print_input_text ('str_critical', $str_critical, + $table_simple->data[3][3] .= ''.__('Str.').''; + $table_simple->data[3][3] .= html_print_input_text ('str_critical', $str_critical, '', 10, 255, true, $disabledBecauseInPolicy).''; } -$table_simple->data[2][3] .= '
'.__('Inverse interval').''; -$table_simple->data[2][3] .= html_print_checkbox ("critical_inverse", 1, $critical_inverse, true); +$table_simple->data[3][3] .= '
'.__('Inverse interval').''; +$table_simple->data[3][3] .= html_print_checkbox ("critical_inverse", 1, $critical_inverse, true); /* FF stands for Flip-flop */ -$table_simple->data[3][0] = __('FF threshold').' ' . ui_print_help_icon ('ff_threshold', true); -$table_simple->colspan[3][1] = 3; +$table_simple->data[4][0] = __('FF threshold').' ' . ui_print_help_icon ('ff_threshold', true); +$table_simple->colspan[4][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 +$table_simple->data[4][1] = html_print_radio_button ('each_ff', 0, '', $each_ff, true) . ' ' . __('All state changing') . ' : '; +$table_simple->data[4][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'); +$table_simple->data[4][1] .= html_print_radio_button ('each_ff', 1, '', $each_ff, true) . ' ' . __('Each state changing') . ' : '; +$table_simple->data[4][1] .= __('To normal'); +$table_simple->data[4][1] .= html_print_input_text ('ff_event_normal', $ff_event_normal, '', 5, 15, true, $disabledBecauseInPolicy) . ' '; +$table_simple->data[4][1] .= __('To warning'); +$table_simple->data[4][1] .= html_print_input_text ('ff_event_warning', $ff_event_warning, '', 5, 15, true, $disabledBecauseInPolicy) . ' '; +$table_simple->data[4][1] .= __('To critical'); +$table_simple->data[4][1] .= html_print_input_text ('ff_event_critical', $ff_event_critical, '', 5, 15, true, $disabledBecauseInPolicy); +$table_simple->data[5][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[4][1] = html_print_checkbox ("history_data_fake", 1, $history_data, true, $disabledBecauseInPolicy); - $table_simple->data[4][1] .= ''; + $table_simple->data[5][1] = html_print_checkbox ("history_data_fake", 1, $history_data, true, $disabledBecauseInPolicy); + $table_simple->data[5][1] .= ''; } else { - $table_simple->data[4][1] = html_print_checkbox ("history_data", 1, $history_data, true, $disabledBecauseInPolicy); + $table_simple->data[5][1] = html_print_checkbox ("history_data", 1, $history_data, true, $disabledBecauseInPolicy); } /* Advanced form part */ @@ -799,9 +807,36 @@ $(document).ready (function () { $("#submit-crtbutton").click (function () { validate_post_process(); }); + //Dynamic_interval; + disabled_status(); + $('#dynamic_interval_select').change (function() { + disabled_status(); + }); }); +function disabled_status () { + if($('#dynamic_interval_select').val() != 0){ + $('#text-min_warning').prop('readonly', true); + $('#text-min_warning').addClass('readonly'); + $('#text-max_warning').prop('readonly', true); + $('#text-max_warning').addClass('readonly'); + $('#text-min_critical').prop('readonly', true); + $('#text-min_critical').addClass('readonly'); + $('#text-max_critical').prop('readonly', true); + $('#text-max_critical').addClass('readonly'); + } else { + $('#text-min_warning').prop('readonly', false); + $('#text-min_warning').removeClass('readonly'); + $('#text-max_warning').prop('readonly', false); + $('#text-max_warning').removeClass('readonly'); + $('#text-min_critical').prop('readonly', false); + $('#text-min_critical').removeClass('readonly'); + $('#text-max_critical').prop('readonly', false); + $('#text-max_critical').removeClass('readonly'); + } +} + // Add a new module macro function add_macro () { var macro_count = parseInt($("#hidden-module_macro_count").val()); diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 45572cdd46..91d5262640 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -176,6 +176,7 @@ $table->size[2] = '15%'; $table->size[3] = '35%'; if (! $module_type) { $table->rowstyle['edit1'] = 'display: none'; + $table->rowstyle['edit0'] = 'display: none'; $table->rowstyle['edit1_1'] = 'display: none'; $table->rowstyle['edit2'] = 'display: none'; $table->rowstyle['edit3'] = 'display: none'; @@ -340,7 +341,16 @@ $table->data['form_agents_3'][3] = html_print_select (array(), 'module[]', $modules_select, false, '', '', true, true, false); - +$table->data['edit0'][0] = __('Dynamic Interval'); +$table->data['edit0'][1] = html_print_extended_select_for_time ('dynamic_interval', '', '', 'None', '0', 10, true, 'width:150px',false); +$table->data['edit0'][2] = ''; +$table->data['edit0'][2] .= ''; +$table->data['edit0'][2] .= ''; +$table->data['edit0'][2] .= '
' . __('Dynamic Min.') . '' . + html_print_input_text ('dynamic_min', '', '', 10, 255, true) . '
' . __('Dynamic Max.') . '' . + html_print_input_text ('dynamic_max', '', '', 10, 255, true) . '
'; +$table->data['edit0'][3] = __('Dynamic Two Tailed: '); +$table->data['edit0'][3] .= html_print_checkbox ("dynamic_two_tailed", 1, '', true); $table->data['edit1'][0] = __('Warning status'); $table->data['edit1'][1] = ''; @@ -656,6 +666,7 @@ $(document).ready (function () { } $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + "tr#delete_table-edit1_1, " + "tr#delete_table-edit2, " + "tr#delete_table-edit3, " + @@ -685,7 +696,7 @@ $(document).ready (function () { params['id_tipo_modulo'] = this.value; $("#module_loading").show (); - $("tr#delete_table-edit1, tr#delete_table-edit2").hide (); + $("tr#delete_table-edit1, tr#delete_table-edit0, tr#delete_table-edit2").hide (); $("#module_name").attr ("disabled", "disabled") $("#module_name option[value!=0]").remove (); jQuery.post ("ajax.php", @@ -708,6 +719,7 @@ $(document).ready (function () { $("#form_edit input[type=text]").attr ("value", ""); $("#form_edit input[type=checkbox]").not ("#checkbox-recursion").removeAttr ("checked"); $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + "tr#delete_table-edit1_1, " + "tr#delete_table-edit2, " + "tr#delete_table-edit3, " + @@ -733,6 +745,7 @@ $(document).ready (function () { $("#agents").html(''); $("#module").html(''); $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + "tr#delete_table-edit1_1, " + "tr#delete_table-edit2, " + "tr#delete_table-edit3, " + @@ -766,6 +779,7 @@ $(document).ready (function () { if (this.checked) { $(".select_modules_row_2").css('display', 'none'); $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + "tr#delete_table-edit1_1, " + "tr#delete_table-edit2, " + "tr#delete_table-edit3, " + @@ -782,6 +796,7 @@ $(document).ready (function () { $(".select_modules_row_2").css('display', ''); if ($('#module_name option:selected').val() == undefined) { $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + "tr#delete_table-edit1_1, " + "tr#delete_table-edit2, " + "tr#delete_table-edit3, " + @@ -812,6 +827,9 @@ $(document).ready (function () { else if (this.id == "checkbox-critical_inverse") { return; //Do none } + else if (this.id == "checkbox-dynamic_two_tailed") { + return; //Do none + } else { if (this.id == "checkbox-force_group") { $("#checkbox-recursion").attr("checked", false); @@ -820,6 +838,7 @@ $(document).ready (function () { if (this.checked) { $(".select_agents_row_2").css('display', 'none'); $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + "tr#delete_table-edit1_1, " + "tr#delete_table-edit2, " + "tr#delete_table-edit3, " + @@ -842,6 +861,7 @@ $(document).ready (function () { $(".select_agents_row_2").css('display', ''); if ($('#id_agents option:selected').val() == undefined) { $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + "tr#delete_table-edit1_1, " + "tr#delete_table-edit2, " + "tr#delete_table-edit3, " + @@ -916,6 +936,7 @@ $(document).ready (function () { } $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + "tr#delete_table-edit1_1, " + "tr#delete_table-edit2, " + "tr#delete_table-edit3, " + @@ -966,7 +987,35 @@ $(document).ready (function () { $("#status_agents").change(function() { $("#groups_select").trigger("change"); }); + + //Dynamic_interval; + disabled_status(); + $('#dynamic_interval_select').change (function() { + disabled_status(); + }); }); + +function disabled_status () { + if($('#dynamic_interval_select').val() != 0){ + $('#text-min_warning').prop('readonly', true); + $('#text-min_warning').addClass('readonly'); + $('#text-max_warning').prop('readonly', true); + $('#text-max_warning').addClass('readonly'); + $('#text-min_critical').prop('readonly', true); + $('#text-min_critical').addClass('readonly'); + $('#text-max_critical').prop('readonly', true); + $('#text-max_critical').addClass('readonly'); + } else { + $('#text-min_warning').prop('readonly', false); + $('#text-min_warning').removeClass('readonly'); + $('#text-max_warning').prop('readonly', false); + $('#text-max_warning').removeClass('readonly'); + $('#text-min_critical').prop('readonly', false); + $('#text-min_critical').removeClass('readonly'); + $('#text-max_critical').prop('readonly', false); + $('#text-max_critical').removeClass('readonly'); + } +} /* ]]> */ $max_timeout, 'max_retries' => $max_retries, 'history_data' => $history_data, + 'dynamic_interval' => $dynamic_interval, + 'dynamic_max' => $dynamic_max, + 'dynamic_min' => $dynamic_min, + 'dynamic_two_tailed' => $dynamic_two_tailed, 'min_warning' => $min_warning, 'max_warning' => $max_warning, 'str_warning' => $str_warning, @@ -298,6 +306,10 @@ if ($update_component) { 'max_timeout' => $max_timeout, 'max_retries' => $max_retries, 'history_data' => $history_data, + 'dynamic_interval' => $dynamic_interval, + 'dynamic_max' => $dynamic_max, + 'dynamic_min' => $dynamic_min, + 'dynamic_two_tailed' => $dynamic_two_tailed, 'min_warning' => $min_warning, 'max_warning' => $max_warning, 'str_warning' => $str_warning, @@ -426,6 +438,10 @@ $url = ui_get_url_refresh (array ('offset' => false, 'id_modulo' => false, 'id_plugin' => false, 'history_data' => false, + 'dynamic_interval' => false, + 'dynamic_max' => false, + 'dynamic_min' => false, + 'dynamic_two_tailed' => false, 'min_warning' => false, 'max_warning' => false, 'str_warning' => false, diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index cf444020ef..5c5eb2ec8e 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -53,6 +53,10 @@ if ($create_network_from_module) { $macros = $data_module["macros"]; $max_timeout = $data_module["max_timeout"]; $max_retries = $data_module["max_retries"]; + $dynamic_interval = $data_module['dynamic_interval']; + $dynamic_max = $data_module['dynamic_max']; + $dynamic_min = $data_module['dynamic_min']; + $dynamic_two_tailed = $data_module['dynamic_two_tailed']; $min_warning = $data_module["min_warning"]; $max_warning = $data_module["max_warning"]; $str_warning = $data_module["str_warning"]; @@ -106,6 +110,10 @@ if (isset ($id)) { $macros = $component["macros"]; $max_timeout = $component["max_timeout"]; $max_retries = $component["max_retries"]; + $dynamic_interval = $component['dynamic_interval']; + $dynamic_max = $component['dynamic_max']; + $dynamic_min = $component['dynamic_min']; + $dynamic_two_tailed = $component['dynamic_two_tailed']; $min_warning = $component["min_warning"]; $max_warning = $component["max_warning"]; $str_warning = $component["str_warning"]; @@ -161,6 +169,10 @@ if (isset ($id)) { $min_warning = 0; $max_warning = 0; $str_warning = ''; + $dynamic_interval = 0; + $dynamic_min = 0; + $dynamic_max = 0; + $dynamic_two_tailed = 0; $max_critical = 0; $min_critical = 0; $str_critical = ''; 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 1fe2f1b36f..71a35b18a8 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_common.php +++ b/pandora_console/godmode/modules/manage_network_components_form_common.php @@ -102,73 +102,82 @@ $table->data[2][1] = html_print_select (network_components_get_groups (), $table->data[2][2] = __('Interval'); $table->data[2][3] = html_print_extended_select_for_time ('module_interval' , $module_interval, '', '', '0', false, true); +$table->data[3][0] = __('Dynamic Interval') .' ' . ui_print_help_icon ('warning_status', true); +html_debug_print($dynamic_interval); +$table->data[3][1] = html_print_extended_select_for_time ('dynamic_interval', $dynamic_interval, '', 'None', '0', 10, true, 'width:150px',false); +$table->data[3][2] = ''.__('Dynamic Min. ').''; +$table->data[3][2] .= html_print_input_text ('dynamic_min', $dynamic_min, '', 10, 255, true); +$table->data[3][2] .= '
'.__('Dynamic Max.').''; +$table->data[3][2] .= html_print_input_text ('dynamic_max', $dynamic_max, '', 10, 255, true); +$table->data[3][3] = ''.__('Dynamic Two Tailed: ').''; +$table->data[3][3] .= html_print_checkbox ("dynamic_two_tailed", 1, $dynamic_two_tailed, true); -$table->data[3][0] = __('Warning status') . ' ' . ui_print_help_icon ('warning_status', true); -$table->data[3][1] = ''.__('Min.').'  '; -$table->data[3][1] .= html_print_input_text ('min_warning', $min_warning, +$table->data[4][0] = __('Warning status') . ' ' . ui_print_help_icon ('warning_status', true); +$table->data[4][1] = ''.__('Min.').'  '; +$table->data[4][1] .= html_print_input_text ('min_warning', $min_warning, '', 5, 15, true); -$table->data[3][1] .= '
'.__('Max.').' '; -$table->data[3][1] .= html_print_input_text ('max_warning', $max_warning, +$table->data[4][1] .= '
'.__('Max.').' '; +$table->data[4][1] .= html_print_input_text ('max_warning', $max_warning, '', 5, 15, true) . '
'; -$table->data[3][1] .= ''.__('Str.').'  '; -$table->data[3][1] .= html_print_input_text ('str_warning', $str_warning, +$table->data[4][1] .= ''.__('Str.').'  '; +$table->data[4][1] .= html_print_input_text ('str_warning', $str_warning, '', 5, 15, true) . ''; -$table->data[3][1] .= '
'.__('Inverse interval').''; -$table->data[3][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true); +$table->data[4][1] .= '
'.__('Inverse interval').''; +$table->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true); -$table->data[3][2] = __('Critical status'). ' ' . ui_print_help_icon ('critical_status', true); -$table->data[3][3] = ''.__('Min.').'  '; -$table->data[3][3] .= html_print_input_text ('min_critical', $min_critical, +$table->data[4][2] = __('Critical status'). ' ' . ui_print_help_icon ('critical_status', true); +$table->data[4][3] = ''.__('Min.').'  '; +$table->data[4][3] .= html_print_input_text ('min_critical', $min_critical, '', 5, 15, true); -$table->data[3][3] .= '
'.__('Max.').' '; -$table->data[3][3] .= html_print_input_text ('max_critical', $max_critical, +$table->data[4][3] .= '
'.__('Max.').' '; +$table->data[4][3] .= html_print_input_text ('max_critical', $max_critical, '', 5, 15, true) . '
'; -$table->data[3][3] .= ''.__('Str.').'  '; -$table->data[3][3] .= html_print_input_text ('str_critical', $str_critical, +$table->data[4][3] .= ''.__('Str.').'  '; +$table->data[4][3] .= html_print_input_text ('str_critical', $str_critical, '', 5, 15, true) . ''; -$table->data[3][3] .= '
'.__('Inverse interval').''; -$table->data[3][3] .= html_print_checkbox ("critical_inverse", 1, $critical_inverse, true); +$table->data[4][3] .= '
'.__('Inverse interval').''; +$table->data[4][3] .= html_print_checkbox ("critical_inverse", 1, $critical_inverse, true); -$table->data[4][0] = __('FF threshold') . ' ' . ui_print_help_icon ('ff_threshold', 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, +$table->data[5][0] = __('FF threshold') . ' ' . ui_print_help_icon ('ff_threshold', true); +$table->colspan[5][1] = 3; +$table->data[5][1] = html_print_radio_button ('each_ff', 0, '', $each_ff, true) . ' ' . __('All state changing') . ' : '; +$table->data[5][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) . ' '; -$table->data[4][1] .= __('To warning'); -$table->data[4][1] .= html_print_input_text ('ff_event_warning', $ff_event_warning, '', 5, 15, true) . ' '; -$table->data[4][1] .= __('To critical'); -$table->data[4][1] .= html_print_input_text ('ff_event_critical', $ff_event_critical, '', 5, 15, true); +$table->data[5][1] .= html_print_radio_button ('each_ff', 1, '', $each_ff, true) . ' ' . __('Each state changing') . ' : '; +$table->data[5][1] .= __('To normal'); +$table->data[5][1] .= html_print_input_text ('ff_event_normal', $ff_event_normal, '', 5, 15, true) . ' '; +$table->data[5][1] .= __('To warning'); +$table->data[5][1] .= html_print_input_text ('ff_event_warning', $ff_event_warning, '', 5, 15, true) . ' '; +$table->data[5][1] .= __('To critical'); +$table->data[5][1] .= html_print_input_text ('ff_event_critical', $ff_event_critical, '', 5, 15, true); -$table->data[5][0] = __('Historical data'); -$table->data[5][1] = html_print_checkbox ("history_data", 1, $history_data, true); +$table->data[6][0] = __('Historical data'); +$table->data[6][1] = html_print_checkbox ("history_data", 1, $history_data, true); -$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][0] = __('Min. Value'); +$table->data[7][1] = html_print_input_text ('min', $min, '', 5, 15, true). ' ' . ui_print_help_tip (__('Any value below this number is discarted'), true); +$table->data[7][2] = __('Max. Value'); +$table->data[7][3] = html_print_input_text ('max', $max, '', 5, 15, true) . ' ' . ui_print_help_tip (__('Any value over this number is discarted'), true); +$table->data[8][0] = __('Unit'); +$table->data[8][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, +$table->data[8][2] = __('Throw unknown events'); +$table->data[8][3] = html_print_checkbox('throw_unknown_events', 1, !network_components_is_disable_type_event($id, EVENTS_GOING_UNKNOWN), 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] = __('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->data[9][0] = __('Critical instructions'). ui_print_help_tip(__("Instructions when the status is critical"), true); +$table->data[9][1] = html_print_textarea ('critical_instructions', 2, 65, $critical_instructions, '', true); $table->colspan[9][1] = 3; -$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->data[10][0] = __('Warning instructions'). ui_print_help_tip(__("Instructions when the status is warning"), true); +$table->data[10][1] = html_print_textarea ('warning_instructions', 2, 65, $warning_instructions, '', true); $table->colspan[10][1] = 3; -$next_row = 11; +$table->data[11][0] = __('Unknown instructions'). ui_print_help_tip(__("Instructions when the status is unknown"), true); +$table->data[11][1] = html_print_textarea ('unknown_instructions', 2, 65, $unknown_instructions, '', true); +$table->colspan[11][1] = 3; + +$next_row = 12; if (check_acl ($config['id_user'], 0, "PM")) { $table->data[$next_row][0] = __('Category'); @@ -178,7 +187,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[10][1] .= html_print_input_hidden ('id_category', $id_category, true); + $table->data[11][1] .= html_print_input_hidden ('id_category', $id_category, true); } $table->data[$next_row][0] = __('Tags'); @@ -237,7 +246,33 @@ $next_row++; $('#minmax_warning').hide(); } }); - + //Dynamic_interval; + disabled_status(); + $('#dynamic_interval_select').change (function() { + disabled_status(); + }); $("#type").trigger('change'); }); + + function disabled_status () { + if($('#dynamic_interval_select').val() != 0){ + $('#text-min_warning').prop('readonly', true); + $('#text-min_warning').addClass('readonly'); + $('#text-max_warning').prop('readonly', true); + $('#text-max_warning').addClass('readonly'); + $('#text-min_critical').prop('readonly', true); + $('#text-min_critical').addClass('readonly'); + $('#text-max_critical').prop('readonly', true); + $('#text-max_critical').addClass('readonly'); + } else { + $('#text-min_warning').prop('readonly', false); + $('#text-min_warning').removeClass('readonly'); + $('#text-max_warning').prop('readonly', false); + $('#text-max_warning').removeClass('readonly'); + $('#text-min_critical').prop('readonly', false); + $('#text-min_critical').removeClass('readonly'); + $('#text-max_critical').prop('readonly', false); + $('#text-max_critical').removeClass('readonly'); + } + } diff --git a/pandora_console/godmode/modules/manage_network_templates.php b/pandora_console/godmode/modules/manage_network_templates.php index db6444bdfd..e5f093a044 100644 --- a/pandora_console/godmode/modules/manage_network_templates.php +++ b/pandora_console/godmode/modules/manage_network_templates.php @@ -103,7 +103,7 @@ if ($export_profile) { components.tcp_port, components.tcp_send, components.tcp_rcv, components.snmp_community, components.snmp_oid, components.id_module_group, components.id_modulo, components.plugin_user, components.plugin_pass, components.plugin_parameter, components.max_timeout, components.max_retries, components.history_data, components.min_warning, components.max_warning, components.str_warning, components.min_critical, - components.max_critical, components.str_critical, components.min_ff_event, comp_group.name AS group_name, components.critical_instructions, components.warning_instructions, components.unknown_instructions + components.max_critical, components.str_critical, components.min_ff_event, components.dynamic_interval, components.dynamic_max, components.dynamic_min, components.dynamic_two_tailed, comp_group.name AS group_name, components.critical_instructions, components.warning_instructions, components.unknown_instructions FROM `tnetwork_component` AS components, tnetwork_profile_component AS tpc, tnetwork_component_group AS comp_group WHERE tpc.id_nc = components.id_nc AND components.id_group = comp_group.id_sg diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 5fb933e85f..0f4508d387 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -709,9 +709,14 @@ function html_print_extended_select_for_time ($name, $selected = '', if ( ! $selected ) { foreach( $fields as $t_key => $t_value){ - if ( $t_key != -1 ) { // -1 means 'custom' - $selected = $t_key; - break; + if ( $t_key != -1 ) { + if($nothing == ''){ // -1 means 'custom' + $selected = $t_key; + break; + } else { + $selected = $nothing; + break; + } } } } diff --git a/pandora_console/include/functions_network_components.php b/pandora_console/include/functions_network_components.php index 557fd81738..66ff6bff0f 100644 --- a/pandora_console/include/functions_network_components.php +++ b/pandora_console/include/functions_network_components.php @@ -451,6 +451,10 @@ function network_components_create_module_from_network_component ($id_network_co 'max_timeout', 'max_retries', 'history_data', + 'dynamic_interval', + 'dynamic_min', + 'dynamic_max', + 'dynamic_two_tailed', 'min_warning', 'max_warning', 'str_warning', diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index cc8e13ae28..92aa49f3a8 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -78,6 +78,10 @@ function configure_modules_form () { $("#checkbox-history_data").check (); $("#text-max").attr ("value", ""); $("#text-min").attr ("value", ""); + $("#dynamic_interval_select").attr ("value", 0); + $("#text-dynamic_min").attr ("value", 0); + $("#text-dynamic_max").attr ("value", 0); + $("#checkbox-dynamic_two_tailed").attr ("value", 0); $("#text-min_warning").attr ("value", 0); $("#text-max_warning").attr ("value", 0); $("#text-str_warning").attr ("value", ''); @@ -134,6 +138,15 @@ function configure_modules_form () { else $("#checkbox-history_data").uncheck (); + $("#dynamic_interval_select").attr ("value", (data["dynamic_interval"] == 0) ? 0 : data["dynamic_interval"]); + $("#text-dynamic_max").attr ("value", (data["dynamic_max"] == 0) ? 0 : data["dynamic_max"]); + $("#text-dynamic_min").attr ("value", (data["dynamic_min"] == 0) ? 0 : data["dynamic_min"]); + + if (data["dynamic_two_tailed"]) + $("#checkbox-dynamic_two_tailed").check (); + else + $("#checkbox-dynamic_two_tailed").uncheck (); + $("#text-min_warning").attr ("value", (data["min_warning"] == 0) ? 0 : data["min_warning"]); $("#text-max_warning").attr ("value", (data["max_warning"] == 0) ? 0 : data["max_warning"]); $("#text-str_warning").attr ("value", data["str_warning"]); @@ -281,6 +294,16 @@ function configure_modules_form () { $("#checkbox-history_data").check (); else $("#checkbox-history_data").uncheck (); + + $("#dynamic_interval_select").attr ("value", (data["dynamic_interval"] == 0) ? 0 : data["dynamic_interval"]); + $("#text-dynamic_max").attr ("value", (data["dynamic_max"] == 0) ? 0 : data["dynamic_max"]); + $("#text-dynamic_min").attr ("value", (data["dynamic_min"] == 0) ? 0 : data["dynamic_min"]); + + if (data["dynamic_two_tailed"]) + $("#checkbox-dynamic_two_tailed").check (); + else + $("#checkbox-dynamic_two_tailed").uncheck (); + $("#text-min_warning").attr ("value", (data["min_warning"] == 0) ? 0 : data["min_warning"]); $("#text-max_warning").attr ("value", (data["max_warning"] == 0) ? 0 : data["max_warning"]); $("#text-str_warning").attr ("value", data["str_warning"]); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 7f24a78c03..a3475ec2e9 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -3562,3 +3562,7 @@ color:#82b92e;font-family:Nunito;font-size:10pt;position:relative;top:6px; } + +.readonly{ + background-color: #dedede !important; +} diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index a1c7f89b3b..2abfb58829 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -283,6 +283,8 @@ CREATE TABLE tagente_modulo ( dynamic_interval INTEGER default 0, dynamic_max INTEGER default 0, dynamic_min INTEGER default 0, + dynamic_next INTEGER NOT NULL default 0, + dynamic_two_tailed INTEGER default 0, prediction_sample_window INTEGER default 0, prediction_samples INTEGER default 0, prediction_threshold INTEGER default 0, @@ -861,6 +863,11 @@ CREATE TABLE tnetwork_component ( min_ff_event_warning INTEGER DEFAULT 0, min_ff_event_critical INTEGER DEFAULT 0, each_ff NUMBER(1, 0) DEFAULT 0, + dynamic_interval INTEGER default 0, + dynamic_max INTEGER default 0, + dynamic_min INTEGER default 0, + dynamic_next INTEGER NOT NULL default 0, + dynamic_two_tailed INTEGER default 0, CONSTRAINT t_network_component_wiz_cons CHECK (wizard_level IN ('basic','advanced','nowizard')) ); diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index ab2bb5ed40..48409e41af 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -245,7 +245,12 @@ CREATE TABLE "tagente_modulo" ( "min_ff_event_warning" INTEGER default 0, "min_ff_event_critical" INTEGER default 0, "each_ff" SMALLINT default 0, - "ff_timeout" INTEGER default 0 + "ff_timeout" INTEGER default 0, + "dynamic_interval" INTEGER default 0, + "dynamic_max" INTEGER default 0, + "dynamic_min" INTEGER default 0, + "dynamic_next" INTEGER NOT NULL default 0, + "dynamic_two_tailed" INTEGER 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"); @@ -702,9 +707,14 @@ CREATE TABLE "tnetwork_component" ( "disabled_types_event" 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 + "min_ff_event_warning" INTEGER default 0, + "min_ff_event_critical" INTEGER default 0, + "each_ff" SMALLINT default 0, + "dynamic_interval" INTEGER default 0, + "dynamic_max" INTEGER default 0, + "dynamic_min" INTEGER default 0, + "dynamic_next" INTEGER NOT NULL default 0, + "dynamic_two_tailed" INTEGER default 0 ); -- --------------------------------------------------------------------- diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 72b6d04a11..f14f6034d6 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -773,6 +773,11 @@ CREATE TABLE IF NOT EXISTS `tnetwork_component` ( `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', + `dynamic_interval` int(4) unsigned default '0', + `dynamic_max` int(4) default '0', + `dynamic_min` int(4) default '0', + `dynamic_next` bigint(20) NOT NULL default '0', + `dynamic_two_tailed` tinyint(1) unsigned default '0', PRIMARY KEY (`id_nc`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;