From db26c7d038e80bb20dc799d8183b9b0f39786258 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 12 Jun 2023 12:33:38 +0200 Subject: [PATCH 1/3] #9756 Change to critical status bulk modules --- .../godmode/massive/massive_edit_modules.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 2f28c86357..a625e038c2 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -662,6 +662,21 @@ $table->data['edit1'][1] = ''; ); $table->data['edit1'][1] .= ''; $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ""; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; $table->data['edit1'][1] .= '
'; + $table->data['edit1'][1] .= ''.__('Change to critical status after.').''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= html_print_input_text( + 'warning_time', + '', + '', + 5, + 15, + true + ); + $table->data['edit1'][1] .= '
'; $table->data['edit1'][2] = __('Critical status'); @@ -2063,6 +2078,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status=' 'disabled_types_event', 'ip_target', 'custom_ip_target', + 'warning_time', 'descripcion', 'min_ff_event_normal', 'min_ff_event_warning', From d2009b72dfa90454dc5ba936b1462265d8ee2fa6 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 14 Jun 2023 09:02:31 +0200 Subject: [PATCH 2/3] #9756 change styles modules bulks --- .../godmode/massive/massive_edit_modules.php | 2671 +++++++++-------- pandora_console/include/functions_html.php | 29 +- 2 files changed, 1489 insertions(+), 1211 deletions(-) diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index a625e038c2..479af83330 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -207,30 +207,14 @@ if ($update) { $table = new stdClass(); $table->id = 'delete_table'; -$table->class = 'databox filters'; +$table->class = 'databox filters filter-table-adv'; $table->width = '100%'; $table->data = []; $table->style = []; -$table->style[0] = 'font-weight: bold;'; -$table->style[2] = 'font-weight: bold'; $table->rowstyle = []; $table->size = []; -$table->size[0] = '15%'; -$table->size[1] = '35%'; -$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'; - $table->rowstyle['edit35'] = 'display: none'; - $table->rowstyle['edit4'] = 'display: none'; - $table->rowstyle['edit5'] = 'display: none'; - $table->rowstyle['edit6'] = 'display: none'; - $table->rowstyle['edit7'] = 'display: none'; -} +$table->size[0] = '50%'; +$table->size[1] = '50%'; $agents = agents_get_group_agents( array_keys(users_get_groups()), @@ -293,44 +277,41 @@ foreach ($module_types as $type) { $types[$type['id_tipo']] = $type['description']; } -$snmp_versions['1'] = 'v. 1'; -$snmp_versions['2'] = 'v. 2'; -$snmp_versions['2c'] = 'v. 2c'; -$snmp_versions['3'] = 'v. 3'; - -$table->width = '100%'; -$table->data = []; - -$table->data['selection_mode'][0] = __('Selection mode'); -$table->data['selection_mode'][1] = ''.__('Select modules first ').''.html_print_radio_button_extended('selection_mode', 'modules', '', $selection_mode, false, '', 'class="mrgn_right_40px"', true).'
'; -$table->data['selection_mode'][1] .= ''.__('Select agents first ').''.html_print_radio_button_extended('selection_mode', 'agents', '', $selection_mode, false, '', 'class="mrgn_right_40px"', true); - -$table->rowclass['form_modules_1'] = 'select_modules_row'; -$table->data['form_modules_1'][0] = __('Module type'); - -$types[0] = __('All'); -$table->colspan['form_modules_1'][1] = 2; -$table->data['form_modules_1'][1] = html_print_select( - $types, - 'module_type', - '', - false, - __('Select'), - -1, - true, - false, - true +$table->data[0][0] = html_print_label_input_block( + __('Selection mode'), + '
'.__('Select modules first ').''.html_print_radio_button_extended('selection_mode', 'modules', '', $selection_mode, false, '', 'class="mrgn_right_40px"', true).'
'.__('Select agents first ').''.html_print_radio_button_extended('selection_mode', 'agents', '', $selection_mode, false, '', 'class="mrgn_right_40px"', true).'
' ); -$table->data['form_modules_1'][3] = __('Select all modules of this type').' '.html_print_checkbox_extended( - 'force_type', - 'type', - '', - '', - false, - 'class="mrgn_right_40px"', - true, - '' +$table->rowclass[1] = 'select_modules_row'; +$types[0] = __('All'); +$table->data[1][0] = html_print_label_input_block( + __('Module type'), + html_print_select( + $types, + 'module_type', + '', + false, + __('Select'), + -1, + true, + false, + true, + 'w100p', + false, + 'width:100%' + ) +); +$table->data[1][1] = html_print_label_input_block( + __('Select all modules of this type'), + html_print_checkbox_extended( + 'force_type', + 'type', + '', + '', + false, + '', + true + ) ); $modules = []; @@ -352,932 +333,1197 @@ foreach ($names as $name) { -$table->rowclass['form_agents_1'] = 'select_agents_row'; -$table->data['form_agents_1'][0] = __('Agent group'); +$table->rowclass[2] = 'select_agents_row'; $groups = groups_get_all(true); $groups[0] = __('All'); -$table->colspan['form_agents_1'][1] = 2; -$table->data['form_agents_1'][1] = html_print_select_groups( - false, - 'AW', - true, - 'groups_select', - '', - false, - '', - '', - true -).' '.__('Group recursion').' '.html_print_checkbox('recursion', 1, false, true, false); -$table->data['form_agents_1'][3] = __('Select all modules of this group').' '.html_print_checkbox_extended( - 'force_group', - 'group', - '', - '', - false, - '', - 'class="mrgn_right_40px"' +$table->data[2][0] = html_print_label_input_block( + __('Agent group'), + html_print_select_groups( + false, + 'AW', + true, + 'groups_select', + '', + false, + '', + '', + true, + false, + false, + 'w100p', + false, + 'width:100%' + ).' '.__('Group recursion').' '.html_print_checkbox('recursion', 1, false, true, false) +); +$table->data[2][1] = html_print_label_input_block( + __('Select all modules of this group'), + html_print_checkbox_extended( + 'force_group', + 'group', + '', + '', + false, + '', + true + ) ); -$table->rowclass['form_modules_3'] = ''; -$table->data['form_modules_3'][0] = __('Module Status'); -$table->colspan['form_modules_3'][1] = 2; +$table->rowclass[3] = ''; $status_list = []; +$table->colspan[3][0] = 2; $status_list[AGENT_MODULE_STATUS_NORMAL] = __('Normal'); $status_list[AGENT_MODULE_STATUS_WARNING] = __('Warning'); $status_list[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical'); $status_list[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown'); $status_list[AGENT_MODULE_STATUS_NOT_NORMAL] = __('Not normal'); $status_list[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init'); -$table->data['form_modules_3'][1] = html_print_select( - $status_list, - 'status_module', - 'selected', - '', - __('All'), - AGENT_MODULE_STATUS_ALL, - true +$table->data[3][0] = html_print_label_input_block( + __('Module Status'), + html_print_select( + $status_list, + 'status_module', + 'selected', + '', + __('All'), + AGENT_MODULE_STATUS_ALL, + true, + false, + true, + 'w100p', + false, + 'width:100%' + ) ); -$table->data['form_modules_3'][3] = ''; $tags = tags_get_user_tags(); -$table->rowstyle['form_modules_4'] = 'vertical-align: top;'; -$table->rowclass['form_modules_4'] = 'select_modules_row select_modules_row_2'; -$table->data['form_modules_4'][0] = __('Tags'); -$table->data['form_modules_4'][1] = html_print_select( - $tags, - 'tags[]', - $tags_name, - false, - __('Any'), - -1, - true, - true, - true +$table->rowstyle[4] = 'vertical-align: top;'; +$table->rowclass[4] = 'select_modules_row select_modules_row_2'; +$table->colspan[4][0] = 2; +$table->data[4][0] = html_print_label_input_block( + __('Tags'), + html_print_select( + $tags, + 'tags[]', + $tags_name, + false, + __('Any'), + -1, + true, + true, + true, + 'w100p', + false, + 'width:100%' + ) ); -$table->rowstyle['form_modules_filter'] = 'vertical-align: top;'; -$table->rowclass['form_modules_filter'] = 'select_modules_row select_modules_row_2'; -$table->data['form_modules_filter'][0] = __('Filter Modules'); -$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true); - -$table->rowstyle['form_modules_2'] = 'vertical-align: top;'; -$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2'; -$table->data['form_modules_2'][0] = __('Modules'); -$table->data['form_modules_2'][1] = html_print_select( - $modules, - 'module_name[]', - $module_name, - false, - __('Select'), - -1, - true, - true, - true -).' '.__('Select all modules').' '.html_print_checkbox('select_all_modules', 1, false, true, false, '', false, "class='static'"); - -$table->data['form_modules_2'][2] = __('When select modules'); -$table->data['form_modules_2'][2] .= '
'; -$table->data['form_modules_2'][2] .= html_print_select( - [ - 'common' => __('Show common agents'), - 'all' => __('Show all agents'), - ], - 'agents_selection_mode', - 'common', - false, - '', - '', - true +$table->rowstyle[5] = 'vertical-align: top;'; +$table->rowclass[5] = 'select_modules_row select_modules_row_2'; +$table->data[5][0] = html_print_label_input_block( + __('Filter Modules'), + html_print_input_text('filter_modules', '', '', false, 255, true) ); -$table->data['form_modules_2'][3] = html_print_select( - [], - 'agents[]', - $agents_select, - false, - __('None'), - 0, - true, - true, - false +$table->data[5][1] = html_print_label_input_block( + __('When select modules'), + html_print_select( + [ + 'common' => __('Show common agents'), + 'all' => __('Show all agents'), + ], + 'agents_selection_mode', + 'common', + false, + '', + '', + true, + false, + true, + 'w100p', + false, + 'width:100%' + ) +); + +$table->rowclass[6] = 'select_modules_row select_modules_row_2'; +$table->data[6][0] = html_print_label_input_block( + __('Modules'), + html_print_select( + $modules, + 'module_name[]', + $module_name, + false, + __('Select'), + -1, + true, + true, + true, + 'w100p', + false, + 'width:100%' + ).' '.__('Select all modules').' '.html_print_checkbox('select_all_modules', 1, false, true, false, '', false, "class='static'") +); + +$table->data[6][1] = html_print_label_input_block( + __('Agent'), + html_print_select( + [], + 'agents[]', + $agents_select, + false, + __('None'), + 0, + true, + true, + false, + 'w100p', + false, + 'width:100%' + ) ); -$table->rowclass['form_agents_2'] = 'select_agents_row'; -$table->data['form_agents_2'][0] = __('Agent Status'); -$table->colspan['form_agents_2'][1] = 2; +$table->rowclass[7] = 'select_agents_row'; $status_list = []; +$table->colspan[7][0] = 2; $status_list[AGENT_STATUS_NORMAL] = __('Normal'); $status_list[AGENT_STATUS_WARNING] = __('Warning'); $status_list[AGENT_STATUS_CRITICAL] = __('Critical'); $status_list[AGENT_STATUS_UNKNOWN] = __('Unknown'); $status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal'); $status_list[AGENT_STATUS_NOT_INIT] = __('Not init'); -$table->data['form_agents_2'][1] = html_print_select( - $status_list, - 'status_agents', - 'selected', - '', - __('All'), - AGENT_STATUS_ALL, - true +$table->data[7][0] = html_print_label_input_block( + __('Agent Status'), + html_print_select( + $status_list, + 'status_agents', + 'selected', + '', + __('All'), + AGENT_STATUS_ALL, + true, + false, + true, + 'w100p', + false, + 'width:100%' + ) ); -$table->data['form_agents_2'][3] = ''; $tags = tags_get_user_tags(); -$table->rowstyle['form_agents_4'] = 'vertical-align: top;'; -$table->rowclass['form_agents_4'] = 'select_agents_row select_agents_row_2'; -$table->data['form_agents_4'][0] = __('Tags'); -$table->data['form_agents_4'][1] = html_print_select( - $tags, - 'tags[]', - $tags_name, - false, - __('Any'), - -1, - true, - true, - true +$table->colspan[8][0] = 2; +$table->rowstyle[8] = 'vertical-align: top;'; +$table->rowclass[8] = 'select_agents_row select_agents_row_2'; +$table->data[8][0] = html_print_label_input_block( + __('Tags'), + html_print_select( + $tags, + 'tags[]', + $tags_name, + false, + __('Any'), + -1, + true, + true, + true, + 'w100p', + false, + 'width:100%' + ) ); -$table->rowstyle['form_agents_filter'] = 'vertical-align: top;'; -$table->rowclass['form_agents_filter'] = 'select_agents_row select_agents_row_2'; -$table->data['form_agents_filter'][0] = __('Filter agents'); -$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true); - -$table->rowstyle['form_agents_3'] = 'vertical-align: top;'; -$table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2'; -$table->data['form_agents_3'][0] = __('Agents'); -$table->data['form_agents_3'][1] = html_print_select( - $agents, - 'id_agents[]', - $agents_id, - false, - '', - '', - true, - true, - false -).' '.__('Select all agents').' '.html_print_checkbox('select_all_agents', 1, false, true, false, '', false, "class='static'"); - -$table->data['form_agents_3'][2] = __('When select agents'); -$table->data['form_agents_3'][2] .= '
'; -$table->data['form_agents_3'][2] .= html_print_select( - [ - 'common' => __('Show common modules'), - 'all' => __('Show all modules'), - 'unknown' => __('Show unknown and not init modules'), - ], - 'modules_selection_mode', - 'common', - false, - '', - '', - true +$table->rowstyle[9] = 'vertical-align: top;'; +$table->rowclass[9] = 'select_agents_row select_agents_row_2'; +$table->data[9][0] = html_print_label_input_block( + __('Filter agents'), + html_print_input_text('filter_agents', '', '', false, 255, true) ); -$table->data['form_agents_3'][3] = html_print_select( - [], - 'module[]', - $modules_select, - false, - '', - '', - true, - true, - false + +$table->data[9][1] = html_print_label_input_block( + __('When select agents'), + html_print_select( + [ + 'common' => __('Show common modules'), + 'all' => __('Show all modules'), + 'unknown' => __('Show unknown and not init modules'), + ], + 'modules_selection_mode', + 'common', + false, + '', + '', + true, + false, + true, + 'w100p', + false, + 'width:100%' + ) +); + +$table->rowstyle[10] = 'vertical-align: top;'; +$table->rowclass[10] = 'select_agents_row select_agents_row_2'; +$table->data[10][0] = html_print_label_input_block( + __('Agents'), + html_print_select( + $agents, + 'id_agents[]', + $agents_id, + false, + '', + '', + true, + true, + false, + 'w100p', + false, + 'width:100%' + ).' '.__('Select all agents').' '.html_print_checkbox('select_all_agents', 1, false, true, false, '', false, "class='static'") +); + +$table->data[10][1] = html_print_label_input_block( + __('Modules'), + html_print_select( + [], + 'module[]', + $modules_select, + false, + '', + '', + true, + true, + false, + 'w100p', + false, + 'width:100%' + ) ); -$table->data['edit0'][0] = __('Dynamic Interval'); -$table->data['edit0'][1] = html_print_extended_select_for_time( - 'dynamic_interval', - -2, - '', - 'None', - '0', - 10, - true, - 'width:150px', - false, - '', - false, - false, - '', - true +$table->data[11][0] = html_print_label_input_block( + __('Dynamic Interval'), + html_print_extended_select_for_time( + 'dynamic_interval', + -2, + '', + 'None', + '0', + 10, + true, + 'width:100%', + false, + '', + false, + false, + '', + true + ) +); +$table->data[11][1] = html_print_label_input_block( + __('Dynamic Two Tailed: '), + html_print_checkbox('dynamic_two_tailed', 1, '', true) ); -$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] = ''; - $table->data['edit1'][1] .= ""; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ""; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ""; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ""; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= '
'; - $table->data['edit1'][1] .= ''.__('Min.').''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= html_print_input_text( - 'min_warning', - '', - '', - 5, - 255, - true - ); - $table->data['edit1'][1] .= '
'; - $table->data['edit1'][1] .= ''.__('Max.').''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= html_print_input_text( - 'max_warning', - '', - '', - 5, - 255, - true - ); - $table->data['edit1'][1] .= '
'; - $table->data['edit1'][1] .= ''.__('Str.').''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= html_print_input_text( - 'str_warning', - '', - '', - 5, - 1024, - true - ); - $table->data['edit1'][1] .= '
'; - $table->data['edit1'][1] .= ''.__('Inverse interval').''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= html_print_select( - [ - '' => __('No change'), - '1' => __('Yes'), - '0' => __('No'), - ], - 'warning_inverse', - '', - '', - '', - '', - true - ); - $table->data['edit1'][1] .= '
'; - $table->data['edit1'][1] .= ''.__('Percentage').''; - $table->data['edit1'][1] .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true); - - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= html_print_select( - [ - '' => __('No change'), - '1' => __('Yes'), - '0' => __('No'), - ], - 'percentage_warning', - '', - '', - '', - '', - true - ); - $table->data['edit1'][1] .= '
'; - $table->data['edit1'][1] .= ''.__('Change to critical status after.').''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= html_print_input_text( - 'warning_time', - '', - '', - 5, - 15, - true - ); - $table->data['edit1'][1] .= '
'; - - $table->data['edit1'][2] = __('Critical status'); - $table->data['edit1'][3] = ''; - $table->data['edit1'][3] .= ""; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ""; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ""; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= '
'; - $table->data['edit1'][3] .= ''.__('Min.').''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= html_print_input_text( - 'min_critical', - '', - '', - 5, - 255, - true - ); - $table->data['edit1'][3] .= '
'; - $table->data['edit1'][3] .= ''.__('Max.').''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= html_print_input_text( - 'max_critical', - '', - '', - 5, - 255, - true - ); - $table->data['edit1'][3] .= '
'; - $table->data['edit1'][3] .= ''.__('Str.').''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= html_print_input_text( - 'str_critical', - '', - '', - 5, - 1024, - true - ); - $table->data['edit1'][3] .= '
'; - $table->data['edit1'][3] .= ''.__('Inverse interval').''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= html_print_select( - [ - '' => __('No change'), - '1' => __('Yes'), - '0' => __('No'), - ], - 'critical_inverse', - '', - '', - '', - '', - true - ); - $table->data['edit1'][3] .= '
'; - $table->data['edit1'][3] .= ''.__('Percentage').''; - $table->data['edit1'][3] .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true); - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= html_print_select( - [ - '' => __('No change'), - '1' => __('Yes'), - '0' => __('No'), - ], - 'percentage_critical', - '', - '', - '', - '', - true - ); - $table->data['edit1'][3] .= '
'; - - $table->data['edit1_1'][0] = ''.__('Description').''; - $table->data['edit1_1'][1] = html_print_textarea( - 'descripcion', - 2, - 50, - '', - '', - true - ); - $table->colspan['edit1_1'][1] = 3; - - $table->data['edit2'][0] = __('Interval'); - $table->data['edit2'][1] = html_print_extended_select_for_time( - 'module_interval', - 0, - '', - __('No change'), - '0', - 10, - true, - 'width: 150px' - ); - $table->data['edit2'][2] = __('Disabled'); - $table->data['edit2'][3] = html_print_select( - [ - '' => __('No change'), - '1' => __('Yes'), - '0' => __('No'), - ], - 'disabled', - '', - '', - '', - '', - true - ); - - $table->data['edit3'][0] = __('Post process'); - - $table->data['edit3'][1] = html_print_extended_select_for_post_process( - 'post_process', - -1, - '', - '', - 0, - false, - true, - 'width:150px;', - true, - false, - 1 - ); - - $table->data['edit3'][2] = __('SNMP community'); - $table->data['edit3'][3] = html_print_input_text( - 'snmp_community', - '', - '', - 10, - 100, - true - ); - - $table->data['edit15'][2] = __('SNMP OID'); - $table->data['edit15'][3] = html_print_input_text( - 'snmp_oid', - '', - '', - 80, - 80, - true - ); - - $target_ip_values = []; - $target_ip_values['auto'] = __('Auto'); - $target_ip_values['force_pri'] = __('Force primary key'); - $target_ip_values['custom'] = __('Custom'); - - $table->data['edit35'][0] = __('Target IP'); - $table->data['edit35'][1] = html_print_select( - $target_ip_values, - 'ip_target', - '', - '', - __('No change'), - '', - true, - false, - false, - '', - false, - 'width:200px;' - ); - - $table->data['edit35'][1] .= html_print_input_text('custom_ip_target', '', '', 15, 60, true); - - $table->data['edit35'][2] = __('SNMP version'); - $table->data['edit35'][3] = html_print_select( - $snmp_versions, - 'snmp_version', - '', - '', - __('No change'), - '', - true, - false, - false, - '' - ); - $table->data['edit36'][0] = __('Auth user'); - $table->data['edit36'][1] = html_print_input_text( - 'plugin_user_snmp', - '', - '', - 15, - 60, - true - ); - $table->data['edit36'][2] = __('Auth password').ui_print_help_tip(__('The pass length must be eight character minimum.'), true); - $table->data['edit36'][3] = html_print_input_password('plugin_pass_snmp', '', '', 15, 60, true); - $table->data['edit37'][0] = __('Privacy method'); - $table->data['edit37'][1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', '', '', __('No change'), '', true); - $table->data['edit37'][2] = __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true); - $table->data['edit37'][3] = html_print_input_password('snmp3_privacy_pass', '', '', 15, 60, true); - $table->data['edit38'][0] = __('Auth method'); - $table->data['edit38'][1] = html_print_select(['MD5' => __('MD5'), 'SHA' => __('SHA')], 'plugin_parameter', '', '', __('No change'), '', true); - $table->data['edit38'][2] = __('Security level'); - $table->data['edit38'][3] = html_print_select( - [ - 'noAuthNoPriv' => __('Not auth and not privacy method'), - 'authNoPriv' => __('Auth and not privacy method'), - 'authPriv' => __('Auth and privacy method'), - ], - 'custom_string_3', - '', - '', - __('No change'), - '', - true - ); - - $table->data['edit4'][0] = __('Value'); - $table->data['edit4'][1] = ''.__('Min.').''; - $table->data['edit4'][1] .= html_print_input_text('min', '', '', 5, 15, true); - $table->data['edit4'][1] .= '
'.__('Max.').''; - $table->data['edit4'][1] .= html_print_input_text('max', '', '', 5, 15, true); - $table->data['edit4'][2] = __('Module group'); - // Create module groups values for select - $module_groups = modules_get_modulegroups(); - $module_groups[0] = __('Not assigned'); - - $table->data['edit4'][3] = html_print_select( - $module_groups, - 'id_module_group', - '', - '', - __('No change'), - '', - true, - false, - false - ); - - $table->data['edit5'][0] = __('Username'); - $table->data['edit5'][1] = html_print_input_text('plugin_user', '', '', 15, 60, true); - $table->data['edit5'][2] = __('Password'); - $table->data['edit5'][3] = html_print_input_password('plugin_pass', '', '', 15, 60, true); - - // Export target - $table->data['edit6'][0] = __('Export target'); - $targets2 = db_get_all_rows_sql('SELECT id, name FROM tserver_export ORDER by name'); - if ($targets2 === false) { - $targets2 = []; - } - - $targets = []; - $targets[0] = __('None'); - foreach ($targets2 as $t) { - $targets[$t['id']] = $t['name']; - } - - $table->data['edit6'][1] = html_print_select($targets, 'id_export', '', '', __('No change'), '', true, false, false); - $table->data['edit6'][2] = __('Unit'); - $table->data['edit6'][3] = html_print_extended_select_for_unit('unit', '-1', '', '', '0', '15', true, false, false, false, 1); - // FF stands for Flip-flop. - $table->data['edit7'][0] = __('FF threshold').' '; +$table->data[12][0] = html_print_label_input_block( + __('Dynamic Min.'), + html_print_input_text('dynamic_min', '', '', false, 255, true) +); +$table->data[12][1] = html_print_label_input_block( + __('Dynamic Max.'), + html_print_input_text('dynamic_max', '', '', false, 255, true) +); - $table->colspan['edit7'][1] = 3; - $table->data['edit7'][1] = __('Mode').' '; - $table->data['edit7'][1] .= html_print_select( - [ - '' => __('No change'), - '1' => __('Each state changing'), - '0' => __('All state changing'), - ], - 'each_ff', - '', - '', - '', - '', - true, - false, - true, - '', - false, - 'width: 400px;' - ).'
'; +$table_warning = new stdClass(); +$table_warning->class = 'filters filter-table-adv'; +$table_warning->width = '100%'; +$table_warning->size[0] = '33%'; +$table_warning->size[1] = '33%'; +$table_warning->size[2] = '33%'; +$table_warning->tdid[0][0] = 'edit1-1-min'; +$table_warning->data[0][0] = html_print_label_input_block( + __('Min.'), + html_print_input_text( + 'min_warning', + '', + '', + false, + 255, + true + ) +); - $table->data['edit7'][1] .= __('All state changing').' : '; - $table->data['edit7'][1] .= html_print_input_text( - 'min_ff_event', - '', - '', - 5, - 15, - true - ).'
'; +$table_warning->tdid[0][1] = 'edit1-1-max'; +$table_warning->data[0][1] = html_print_label_input_block( + __('Max.'), + html_print_input_text( + 'max_warning', + '', + '', + false, + 255, + true + ) +); - $table->data['edit7'][1] .= __('Each state changing').' : '; - $table->data['edit7'][1] .= __('To normal').' '; - $table->data['edit7'][1] .= html_print_input_text( - 'min_ff_event_normal', - '', - '', - 5, - 15, - true - ).' '; +$table_warning->tdid[0][2] = 'edit1-1-str'; +$table_warning->data[0][2] = html_print_label_input_block( + __('Str.'), + html_print_input_text( + 'str_warning', + '', + '', + false, + 1024, + true + ) +); - $table->data['edit7'][1] .= __('To warning').' '; - $table->data['edit7'][1] .= html_print_input_text( - 'min_ff_event_warning', - '', - '', - 5, - 15, - true - ).' '; +$table_warning->data[1][0] = html_print_label_input_block( + __('Inverse interval'), + html_print_select( + [ + '' => __('No change'), + '1' => __('Yes'), + '0' => __('No'), + ], + 'warning_inverse', + '', + '', + '', + '', + true, + false, + true, + 'w100p', + false, + 'width:100%' + ) +); - $table->data['edit7'][1] .= __('To critical').' '; - $table->data['edit7'][1] .= html_print_input_text( - 'min_ff_event_critical', - '', - '', - 5, - 15, - true - ).'
'; +$table_warning->data[1][1] = html_print_label_input_block( + __('Percentage').ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true), + html_print_select( + [ + '' => __('No change'), + '1' => __('Yes'), + '0' => __('No'), + ], + 'percentage_warning', + '', + '', + '', + '', + true, + false, + true, + 'w100p', + false, + 'width:100%' + ) +); - $table->data['edit7'][1] .= __('Keep counters').' '; - $table->data['edit7'][1] .= html_print_select( - [ - '' => __('No change'), - '1' => __('Active Counters'), - '0' => __('Inactive Counters'), - ], - 'ff_type', - '', - '', - '', - '', - true, - false, - true, - '', - false, - 'width: 400px;' - ); +$table_warning->data[1][2] = html_print_label_input_block( + __('Change to critical status after.'), + html_print_input_text( + 'warning_time', + '', + '', + false, + 15, + true + ) +); - $table->data['edit8'][0] = __('FF interval'); - $table->data['edit8'][1] = html_print_input_text( - 'module_ff_interval', - '', - '', - 5, - 10, - true - ); - $table->data['edit8'][1] .= ui_print_help_tip( - __('Module execution flip flop time interval (in secs).'), - true - ); - - $table->data['edit8'][2] = __('FF timeout'); - $table->data['edit8'][3] = html_print_input_text( - 'ff_timeout', - '', - '', - 5, - 10, - true - ); - $table->data['edit8'][3] .= 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 - ); - - $table->data['edit9'][0] = __('Historical data'); - $table->data['edit9'][1] = html_print_select(['' => __('No change'), '1' => __('Yes'), '0' => __('No')], 'history_data', '', '', '', '', true); - - // Tags avalaible - $id_tag = []; - $table->data['edit10'][0] = __('Tags'); - $table->data['edit10'][1] = html_print_select_from_sql( - 'SELECT id_tag, name FROM ttag ORDER BY name', - 'id_tag[]', - $id_tag, - '', - __('None'), - '0', - true, - true, - false, - false - ); - $table->data['edit10'][2] = __('Category'); - $table->data['edit10'][3] = html_print_select(categories_get_all_categories('forselect'), 'id_category', '', '', __('No change'), '', true, false, false); - - if (enterprise_installed()) { - $table->rowspan['edit10'][0] = $table->rowspan['edit10'][1] = 2; - - $table->data['edit101'][2] = __('Policy linking status').ui_print_help_tip(__('This field only has sense in modules adopted by a policy.'), true); - $table->data['edit101'][3] = html_print_select([MODULE_PENDING_LINK => __('Linked'), MODULE_PENDING_UNLINK => __('Unlinked')], 'policy_linked', '', '', __('No change'), '', true, false, false); - } - - if ($table->rowspan['edit10'][0] == 2) { - $table->rowspan['edit10'][0] = $table->rowspan['edit10'][1] = 3; - } else { - $table->rowspan['edit10'][0] = $table->rowspan['edit10'][1] = 2; - } - - $table->data['edit102'][2] = __('Discard unknown events'); - - $table->data['edit102'][3] = html_print_select( - [ - '' => __('No change'), - '1' => __('Yes'), - '0' => __('No'), - ], - 'throw_unknown_events', - '', - '', - '', - '', - true - ); - - $table->data['edit12'][0] = ''.__('Critical instructions').''.ui_print_help_tip(__('Instructions when the status is critical'), true); - $table->data['edit12'][1] = html_print_textarea('critical_instructions', 2, 50, '', '', true); - $table->colspan['edit12'][1] = 3; - - $table->data['edit13'][0] = ''.__('Warning instructions').''.ui_print_help_tip(__('Instructions when the status is warning'), true); - $table->data['edit13'][1] = html_print_textarea('warning_instructions', 2, 50, '', '', true); - $table->colspan['edit13'][1] = 3; - - $table->data['edit14'][0] = ''.__('Unknown instructions').''.ui_print_help_tip(__('Instructions when the status is unknown'), true); - $table->data['edit14'][1] = html_print_textarea('unknown_instructions', 2, 50, '', '', true); - $table->colspan['edit14'][1] = 3; - - $table->data['edit11'][0] = __('Quiet'); - $table->data['edit11'][0] .= ui_print_help_tip(__('The module still store data but the alerts and events will be stop'), true); - $table->data['edit11'][1] = html_print_select( - [ - -1 => __('No change'), - 1 => __('Yes'), - 0 => __('No'), - ], - 'quiet_select', - -1, - '', - '', - 0, - true - ); +$table->colspan[13][0] = 2; +$table->data[13][0] = html_print_label_input_block(__('Warning status'), html_print_table($table_warning, true)); - $table->data['edit11'][2] = __('Timeout'); - $table->data['edit11'][3] = html_print_input_text( - 'max_timeout', - '', - '', - 5, - 10, - true - ).' '.ui_print_help_tip( - __('Seconds that agent will wait for the execution of the module.'), - true - ); +$table_critical = new stdClass(); +$table_critical->class = 'filters filter-table-adv'; +$table_critical->width = '100%'; +$table_critical->size[0] = '33%'; +$table_critical->size[1] = '33%'; +$table_critical->size[2] = '33%'; +$table_critical->tdid[0][0] = 'edit1-3-min'; +$table_critical->data[0][0] = html_print_label_input_block( + __('Min.'), + html_print_input_text( + 'min_warning', + '', + '', + false, + 255, + true + ) +); - $table->data['edit16'][0] = __('Retries'); - $table->data['edit16'][1] = html_print_input_text('max_retries', '', '', 5, 10, true).' '.ui_print_help_tip( - __('Number of retries that the module will attempt to run.'), - true - ); +$table_critical->tdid[0][1] = 'edit1-3-max'; +$table_critical->data[0][1] = html_print_label_input_block( + __('Max.'), + html_print_input_text( + 'max_warning', + '', + '', + false, + 255, + true + ) +); - $table->data['edit22'][0] = __('Web checks'); - ; - $table->data['edit22'][1] = ''; +$table_critical->tdid[0][2] = 'edit1-3-str'; +$table_critical->data[0][2] = html_print_label_input_block( + __('Str.'), + html_print_input_text( + 'str_warning', + '', + '', + false, + 1024, + true + ) +); - $table->data['edit16'][2] = __('Port'); - $table->data['edit16'][3] = html_print_input_text('tcp_port', '', '', 5, 20, true); +$table_critical->data[1][0] = html_print_label_input_block( + __('Inverse interval'), + html_print_select( + [ + '' => __('No change'), + '1' => __('Yes'), + '0' => __('No'), + ], + 'warning_inverse', + '', + '', + '', + '', + true, + false, + true, + 'w100p', + false, + 'width:100%' + ) +); - $table->data['edit17'][0] = __('TCP send'); - $table->data['edit17'][1] = html_print_textarea('tcp_send2', 2, 65, '', '', true); +$table_critical->data[1][1] = html_print_label_input_block( + __('Percentage').ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true), + html_print_select( + [ + '' => __('No change'), + '1' => __('Yes'), + '0' => __('No'), + ], + 'percentage_warning', + '', + '', + '', + '', + true, + false, + true, + 'w100p', + false, + 'width:100%' + ) +); - $table->data['edit17'][2] = __('TCP receive'); - $table->data['edit17'][3] = html_print_textarea('tcp_rcv', 2, 65, '', '', true); +$table_critical->data[1][2] = html_print_label_input_block( + __('Change to critical status after.'), + html_print_input_text( + 'warning_time', + '', + '', + false, + 15, + true + ) +); - $table->data['edit18'][0] = __('WMI query'); - $table->data['edit18'][1] = html_print_input_text('wmi_query', '', '', 35, 255, true); +$table->colspan[14][0] = 2; +$table->data[14][0] = html_print_label_input_block(__('Critical status'), html_print_table($table_critical, true)); - $table->data['edit18'][2] = __('Key string'); - $table->data['edit18'][3] = html_print_input_text('key_string', '', '', 20, 60, true); +$table->colspan[15][0] = 2; +$table->data[15][0] = html_print_label_input_block( + __('Description'), + html_print_textarea( + 'descripcion', + 2, + 50, + '', + '', + true + ) +); - $table->data['edit19'][0] = __('Field number'); - $table->data['edit19'][1] = html_print_input_text('field_number', '', '', 5, 15, true); +$table->data[16][0] = html_print_label_input_block( + __('Interval'), + html_print_extended_select_for_time( + 'module_interval', + 0, + '', + __('No change'), + '0', + 10, + true, + 'width:100%' + ) +); - $table->data['edit20'][0] = __('Plugin').ui_print_help_icon('plugin_macros', true); - $table->data['edit20'][1] = html_print_select_from_sql( - 'SELECT id, name FROM tplugin ORDER BY name', - 'id_plugin', - '', - 'changePluginSelect();', - __('None'), - 0, - true, - false, - false - ); +$table->data[16][1] = html_print_label_input_block( + __('Disabled'), + html_print_select( + [ + '' => __('No change'), + '1' => __('Yes'), + '0' => __('No'), + ], + 'disabled', + '', + '', + '', + '', + true, + false, + true, + 'w100p', + false, + 'width:100%' + ) +); + +$table->data[17][0] = html_print_label_input_block( + __('Post process'), + html_print_extended_select_for_post_process( + 'post_process', + -1, + '', + '', + 0, + false, + true, + 'width:95%', + true, + false, + 1 + ) +); + +$table->data[17][1] = html_print_label_input_block( + __('SNMP community'), + html_print_input_text( + 'snmp_community', + '', + '', + false, + 100, + true + ) +); + +$table->colspan[18][0] = 2; +$table->data[18][0] = html_print_label_input_block( + __('SNMP OID'), + html_print_input_text( + 'snmp_oid', + '', + '', + false, + 80, + true + ) +); + +$target_ip_values = []; +$target_ip_values['auto'] = __('Auto'); +$target_ip_values['force_pri'] = __('Force primary key'); +$target_ip_values['custom'] = __('Custom'); + +$table->data[19][0] = html_print_label_input_block( + __('Target IP'), + html_print_select( + $target_ip_values, + 'ip_target', + '', + '', + __('No change'), + '', + true, + false, + false, + 'w100p', + false, + 'width:100%' + ).html_print_input_text('custom_ip_target', '', '', false, 60, true) +); + +$snmp_versions['1'] = 'v. 1'; +$snmp_versions['2'] = 'v. 2'; +$snmp_versions['2c'] = 'v. 2c'; +$snmp_versions['3'] = 'v. 3'; + +$table->data[19][1] = html_print_label_input_block( + __('SNMP version'), + html_print_select( + $snmp_versions, + 'snmp_version', + '', + '', + __('No change'), + '', + true, + false, + false, + 'w100p', + false, + 'width:100%' + ) +); + +$table->data[20][0] = html_print_label_input_block( + __('Auth user'), + html_print_input_text( + 'plugin_user_snmp', + '', + '', + false, + 60, + true + ) +); + +$table->data[20][1] = html_print_label_input_block( + __('Auth password').ui_print_help_tip(__('The pass length must be eight character minimum.'), true), + html_print_input_password('plugin_pass_snmp', '', '', 15, 60, true) +); + +$table->data[21][0] = html_print_label_input_block( + __('Privacy method'), + html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', '', '', __('No change'), '', true, false, true, 'w100p', false, 'width:100%') +); + +$table->data[21][1] = html_print_label_input_block( + __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true), + html_print_input_password('snmp3_privacy_pass', '', '', 15, 60, true) +); + +$table->data[22][0] = html_print_label_input_block( + __('Auth method'), + html_print_select(['MD5' => __('MD5'), 'SHA' => __('SHA')], 'plugin_parameter', '', '', __('No change'), '', true, false, true, 'w100p', false, 'width:100%') +); + +$table->data[22][1] = html_print_label_input_block( + __('Security level'), + html_print_select( + [ + 'noAuthNoPriv' => __('Not auth and not privacy method'), + 'authNoPriv' => __('Auth and not privacy method'), + 'authPriv' => __('Auth and privacy method'), + ], + 'custom_string_3', + '', + '', + __('No change'), + '', + true, + false, + true, + 'w100p', + false, + 'width:100%' + ) +); - // Store the macros in base64 into a hidden control to move between pages - $table->data['edit21'][0] = html_print_input_hidden('macros', base64_encode($macros), true); +$table_value = new stdClass(); +$table_value->class = 'filters filter-table-adv'; +$table_value->width = '100%'; +$table_value->size[0] = '50%'; +$table_value->size[1] = '50%'; - $table->colspan['edit23'][1] = 3; - $table->data['edit23'][0] = __('Command'); - $table->data['edit23'][1] = html_print_input_text_extended( - 'tcp_send', - '', - 'command_text', - '', - 100, - 10000, - false, - '', - '', - true - ); +$table_value->data[0][0] = html_print_label_input_block( + __('Min.'), + html_print_input_text('min', '', '', false, 15, true) +); - require_once $config['homedir'].'/include/class/CredentialStore.class.php'; - $array_credential_identifier = CredentialStore::getKeys('CUSTOM'); +$table_value->data[0][1] = html_print_label_input_block( + __('Max.'), + html_print_input_text('max', '', '', false, 15, true) +); - $table->data['edit24'][0] = __('Credential identifier'); - $table->data['edit24'][1] = html_print_select( - $array_credential_identifier, - 'custom_string_1', - '', - '', - __('None'), - '', - true, - false, - false - ); +$table->data[23][0] = html_print_label_input_block( + __('Value'), + html_print_table($table_value, true) +); - $array_os = [ - '' => __('No change'), - 'inherited' => __('Inherited'), - 'linux' => __('Linux'), - 'windows' => __('Windows'), - ]; - $table->data['edit24'][2] = __('Target OS'); - $table->data['edit24'][3] = html_print_select( - $array_os, - 'custom_string_2', - '', - '', - '', - '', - true, - false, - false, - '' - ); +// Create module groups values for select. +$module_groups = modules_get_modulegroups(); +$module_groups[0] = __('Not assigned'); +$table->data[23][1] = html_print_label_input_block( + __('Module group'), + html_print_select( + $module_groups, + 'id_module_group', + '', + '', + __('No change'), + '', + true, + false, + false, + 'w100p', + false, + 'width:100%' + ) +); - if (empty($id_plugin) === false) { - $preload = db_get_sql( - sprintf( - 'SELECT description FROM tplugin WHERE id = %s', - $id_plugin - ) - ); - $preload = io_safe_output($preload); - $preload = str_replace("\n", '
', $preload); - } else { - $preload = ''; - } +$table->data[24][0] = html_print_label_input_block( + __('Username'), + html_print_input_text('plugin_user', '', '', false, 60, true) +); - $table->data['edit21'][1] = sprintf( - '%s', - $preload - ); +$table->data[24][1] = html_print_label_input_block( + __('Password'), + html_print_input_password('plugin_pass', '', '', 15, 60, true) +); - echo '
'; + +// Export target. +$targets2 = db_get_all_rows_sql('SELECT id, name FROM tserver_export ORDER by name'); +if ($targets2 === false) { + $targets2 = []; +} + +$targets = []; +$targets[0] = __('None'); +foreach ($targets2 as $t) { + $targets[$t['id']] = $t['name']; +} + +$table->data[25][0] = html_print_label_input_block( + __('Export target'), + html_print_select($targets, 'id_export', '', '', __('No change'), '', true, false, false, 'w100p', false, 'width:100%') +); + +$table->data[25][1] = html_print_label_input_block( + __('Unit'), + html_print_extended_select_for_unit('unit', '-1', '', '', '0', false, true, 'width:100%;', false, false, 1, 'w100p flex') +); + +// FF stands for Flip-flop. +$table_threshold = new stdClass(); +$table_threshold->class = 'filters filter-table-adv'; +$table_threshold->width = '100%'; +$table_threshold->size[0] = '33%'; +$table_threshold->size[1] = '33%'; +$table_threshold->size[2] = '33%'; + +$table_threshold->data[0][0] = html_print_label_input_block( + __('Mode'), + html_print_select( + [ + '' => __('No change'), + '1' => __('Each state changing'), + '0' => __('All state changing'), + ], + 'each_ff', + '', + '', + '', + '', + true, + false, + true, + 'w100p', + false, + 'width:100%' + ) +); + +$table_threshold->data[0][1] = html_print_label_input_block( + __('All state changing'), + html_print_input_text( + 'min_ff_event', + '', + '', + false, + 15, + true, + false, + false, + '', + 'w100p' + ) +); + +$table_threshold->data[0][2] = html_print_label_input_block( + __('Keep counters'), + html_print_select( + [ + '' => __('No change'), + '1' => __('Active Counters'), + '0' => __('Inactive Counters'), + ], + 'ff_type', + '', + '', + '', + '', + true, + false, + true, + 'w100p', + false, + 'width:100%' + ) +); + +$table_change_status = new stdClass(); +$table_change_status->class = 'filters filter-table-adv'; +$table_change_status->width = '100%'; +$table_change_status->size[0] = '33%'; +$table_change_status->size[1] = '33%'; +$table_change_status->size[2] = '33%'; + + +$table_change_status->data[0][0] = html_print_label_input_block( + __('To normal'), + html_print_input_text( + 'min_ff_event_normal', + '', + '', + false, + 15, + true + ) +); + +$table_change_status->data[0][1] = html_print_label_input_block( + __('To warning'), + html_print_input_text( + 'min_ff_event_warning', + '', + '', + false, + 15, + true + ) +); + +$table_change_status->data[0][2] = html_print_label_input_block( + __('To critical'), + html_print_input_text( + 'min_ff_event_critical', + '', + '', + false, + 15, + true + ) +); + +$table_threshold->colspan[1][0] = 3; +$table_threshold->data[1][0] = html_print_label_input_block( + __('Each state changing'), + html_print_table($table_change_status, true) +); + +$table->colspan[26][0] = 2; +$table->data[26][0] = html_print_label_input_block( + __('FF threshold'), + html_print_table($table_threshold, true) +); + +$table->data[27][0] = html_print_label_input_block( + __('FF interval').ui_print_help_tip( + __('Module execution flip flop time interval (in secs).'), + true + ), + html_print_input_text( + 'module_ff_interval', + '', + '', + false, + 10, + true + ) +); + +$table->data[27][1] = html_print_label_input_block( + __('FF timeout').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 + ), + html_print_input_text( + 'ff_timeout', + '', + '', + false, + 10, + true + ) +); + +$table->data[28][0] = html_print_label_input_block( + __('Historical data'), + html_print_select(['' => __('No change'), '1' => __('Yes'), '0' => __('No')], 'history_data', '', '', '', '', true, false, true, 'w100p', false, 'width:100%') +); + +$table->data[28][1] = html_print_label_input_block( + __('Category'), + html_print_select(categories_get_all_categories('forselect'), 'id_category', '', '', __('No change'), '', true, false, false, 'w100p', false, 'width:100%') +); + +// Tags avalaible. +$table->data[29][0] = html_print_label_input_block( + __('Tags'), + html_print_select_from_sql( + 'SELECT id_tag, name FROM ttag ORDER BY name', + 'id_tag[]', + $id_tag, + '', + __('None'), + '0', + true, + true, + false, + false, + 'width: 100%', + false, + 'width:100%' + ) +); + +$table->data[29][1] = html_print_label_input_block( + __('Discard unknown events'), + html_print_select( + [ + '' => __('No change'), + '1' => __('Yes'), + '0' => __('No'), + ], + 'throw_unknown_events', + '', + '', + '', + '', + true, + false, + true, + 'w100p', + false, + 'width:100%' + ) +); + +if (enterprise_installed()) { + $table->data[30][0] = html_print_label_input_block( + __('Policy linking status').ui_print_help_tip(__('This field only has sense in modules adopted by a policy.'), true), + html_print_select([MODULE_PENDING_LINK => __('Linked'), MODULE_PENDING_UNLINK => __('Unlinked')], 'policy_linked', '', '', __('No change'), '', true, false, false, 'w100p', false, 'width:100%') + ); +} + +$table->data[32][0] = html_print_label_input_block( + __('Critical instructions').ui_print_help_tip(__('Instructions when the status is critical'), true), + html_print_textarea('critical_instructions', 2, 50, '', '', true) +); + +$table->data[32][1] = html_print_label_input_block( + __('Warning instructions').ui_print_help_tip(__('Instructions when the status is warning'), true), + html_print_textarea('warning_instructions', 2, 50, '', '', true) +); + +$table->data[33][0] = html_print_label_input_block( + __('Unknown instructions').ui_print_help_tip(__('Instructions when the status is unknown'), true), + html_print_textarea('unknown_instructions', 2, 50, '', '', true) +); + +$table->data[33][1] = html_print_label_input_block( + __('Quiet').ui_print_help_tip(__('The module still store data but the alerts and events will be stop'), true), + html_print_select( + [ + -1 => __('No change'), + 1 => __('Yes'), + 0 => __('No'), + ], + 'quiet_select', + -1, + '', + '', + 0, + true, + false, + true, + 'w100p', + false, + 'width:100%' + ) +); + +$table_timeout = new stdClass(); +$table_timeout->class = 'filters filter-table-adv'; +$table_timeout->width = '100%'; +$table_timeout->size[0] = '33%'; +$table_timeout->size[1] = '33%'; +$table_timeout->size[2] = '33%'; + +$table_timeout->data[0][0] = html_print_label_input_block( + __('Timeout').ui_print_help_tip( + __('Seconds that agent will wait for the execution of the module.'), + true + ), + html_print_input_text( + 'max_timeout', + '', + '', + false, + 10, + true + ) +); + +$table_timeout->data[0][1] = html_print_label_input_block( + __('Retries').ui_print_help_tip(__('Number of retries that the module will attempt to run.'), true), + html_print_input_text('max_retries', '', '', false, 10, true), +); + +$table_timeout->data[0][2] = html_print_label_input_block( + __('Port'), + html_print_input_text('tcp_port', '', '', false, 20, true) +); + +$table->colspan[34][0] = 2; +$table->data[34][0] = html_print_label_input_block( + '', + html_print_table($table_timeout, true) +); + +$table->colspan[35][0] = 2; +$table->data[35][0] = html_print_label_input_block( + __('Web checks'), + '' +); + +$table->data[36][0] = html_print_label_input_block( + __('TCP send'), + html_print_textarea('tcp_send2', 2, 65, '', '', true) +); + +$table->data[36][1] = html_print_label_input_block( + __('TCP receive'), + html_print_textarea('tcp_rcv', 2, 65, '', '', true) +); + +$table->data[37][0] = html_print_label_input_block( + __('WMI query'), + html_print_input_text('wmi_query', '', '', false, 255, true) +); + +$table->data[37][1] = html_print_label_input_block( + __('Key string'), + html_print_input_text('key_string', '', '', false, 60, true) +); + +$table->data[38][0] = html_print_label_input_block( + __('Field number'), + html_print_input_text('field_number', '', '', false, 15, true) +); + +if (empty($id_plugin) === false) { + $preload = db_get_sql( + sprintf( + 'SELECT description FROM tplugin WHERE id = %s', + $id_plugin + ) + ); + $preload = io_safe_output($preload); + $preload = str_replace("\n", '
', $preload); +} else { + $preload = ''; +} + +$table->data[38][1] = html_print_label_input_block( + __('Plugin').ui_print_help_icon('plugin_macros', true), + html_print_select_from_sql( + 'SELECT id, name FROM tplugin ORDER BY name', + 'id_plugin', + '', + 'changePluginSelect();', + __('None'), + 0, + true, + false, + false, + false, + 'width:100%' + ).sprintf( + '%s', + $preload + ) +); + +// Store the macros in base64 into a hidden control to move between pages. +$table->data[39][0] = html_print_label_input_block( + __('Command'), + html_print_input_text_extended( + 'tcp_send', + '', + 'command_text', + '', + false, + 10000, + false, + '', + '', + true + ).html_print_input_hidden('macros', base64_encode($macros), true) +); + +require_once $config['homedir'].'/include/class/CredentialStore.class.php'; +$array_credential_identifier = CredentialStore::getKeys('CUSTOM'); + +$table->data[39][1] = html_print_label_input_block( + __('Credential identifier'), + html_print_select( + $array_credential_identifier, + 'custom_string_1', + '', + '', + __('None'), + '', + true, + false, + false, + 'w100p' + ) +); + +$array_os = [ + '' => __('No change'), + 'inherited' => __('Inherited'), + 'linux' => __('Linux'), + 'windows' => __('Windows'), +]; +$table->data[40][0] = html_print_label_input_block( + __('rget OS'), + html_print_select( + $array_os, + 'custom_string_2', + '', + '', + '', + '', + true, + false, + false, + 'w100p' + ) +); + + echo ''; html_print_table($table); attachActionButton('update', 'update', $table->width, false, $SelectAction); @@ -1292,15 +1538,15 @@ $table->data['edit1'][1] = ''; ui_require_javascript_file('pandora_modules'); ui_require_jquery_file('pandora.controls'); - if ($selection_mode == 'modules') { - $modules_row = ''; - $agents_row = 'none'; - } else { - $modules_row = 'none'; - $agents_row = ''; - } +if ($selection_mode == 'modules') { + $modules_row = ''; + $agents_row = 'none'; +} else { + $modules_row = 'none'; + $agents_row = ''; +} - ?> +?> '; + echo '
'; html_print_select( $fields, $uniq_name.'_select', @@ -3876,6 +3877,14 @@ function html_print_table(&$table, $return=false) } } + if (isset($table->tdid)) { + foreach ($table->tdid as $keyrow => $tid) { + foreach ($tid as $key => $id) { + $tdid[$keyrow][$key] = $id; + } + } + } + if (isset($table->cellstyle)) { foreach ($table->cellstyle as $keyrow => $cstyle) { foreach ($cstyle as $key => $cst) { @@ -4059,6 +4068,10 @@ function html_print_table(&$table, $return=false) $colspan[$keyrow][$key] = ''; } + if (!isset($tdid[$keyrow][$key])) { + $tdid[$keyrow][$key] = ''; + } + if (!isset($rowspan[$keyrow][$key])) { $rowspan[$keyrow][$key] = ''; } @@ -4079,10 +4092,16 @@ function html_print_table(&$table, $return=false) $style[$key] = ''; } - if ($class === 'datos5' && $key === 1) { - $output .= '
'."\n"; + if ($tdid[$keyrow][$key] !== '') { + $tid = $tdid[$keyrow][$key]; } else { - $output .= ''."\n"; + $tid = $tableid.'-'.$keyrow.'-'.$key; + } + + if ($class === 'datos5' && $key === 1) { + $output .= ''."\n"; + } else { + $output .= ''."\n"; } } From f734b46a8015a97ab60d30c8f17eed947af89ea9 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 11 Jul 2023 12:21:16 +0200 Subject: [PATCH 3/3] #9756 fix warning critical status remove duplicate --- .../godmode/massive/massive_edit_modules.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index ebeffd33d3..573bcc443f 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -847,18 +847,6 @@ $table_critical->data[1][1] = html_print_label_input_block( ) ); -$table_critical->data[1][2] = html_print_label_input_block( - __('Change to critical status after.'), - html_print_input_text( - 'warning_time', - '', - '', - false, - 15, - true - ) -); - $table->colspan[14][0] = 2; $table->data[14][0] = html_print_label_input_block(__('Critical status'), html_print_table($table_critical, true));
'.$item.''.$item.''.$item.''.$item.'