diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index ac22324c79..0fd6bebff8 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -141,17 +141,19 @@ $buttons['vis'] = [ ]; if (check_acl($config['id_user'], 0, 'AW')) { - $buttons['net'] = [ - 'active' => false, - 'text' => ''.html_print_image( - 'images/op_netflow.png', - true, - [ - 'title' => __('Netflow'), - 'class' => 'invert_filter', - ] - ).'', - ]; + if ($config['activate_netflow']) { + $buttons['net'] = [ + 'active' => false, + 'text' => ''.html_print_image( + 'images/op_netflow.png', + true, + [ + 'title' => __('Netflow'), + 'class' => 'invert_filter', + ] + ).'', + ]; + } if ($config['activate_sflow']) { $buttons['sflow'] = [ diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index a791b90aa4..aa55893d11 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -391,6 +391,20 @@ $table->data[$i][] = html_print_label_input_block( ); $table->data[$i++][] = html_print_label_input_block( + __('Enable Netflow'), + html_print_checkbox_switch_extended( + 'activate_netflow', + 1, + $config['activate_netflow'], + $rbt_disabled, + '', + '', + true + ) +); + + +$table->data[$i][] = html_print_label_input_block( __('Enable Sflow'), html_print_checkbox_switch_extended( 'activate_sflow', @@ -403,7 +417,7 @@ $table->data[$i++][] = html_print_label_input_block( ), ); -$table->data[$i][] = html_print_label_input_block( +$table->data[$i++][] = html_print_label_input_block( __('General network path'), html_print_input_text( 'general_network_path', diff --git a/pandora_console/godmode/setup/setup_netflow.php b/pandora_console/godmode/setup/setup_netflow.php index a133a2b531..b939a01825 100644 --- a/pandora_console/godmode/setup/setup_netflow.php +++ b/pandora_console/godmode/setup/setup_netflow.php @@ -36,70 +36,49 @@ check_login(); $update = (bool) get_parameter('update'); $table = new stdClass(); -$table->id = 'table_netflow'; $table->width = '100%'; $table->class = 'databox filter-table-adv'; $table->border = 0; $table->data = []; -// Enable Netflow. -if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { - $rbt_disabled = true; -} else { - $rbt_disabled = false; -} - $table->data[0][] = html_print_label_input_block( - __('Enable Netflow'), - html_print_checkbox_switch_extended( - 'activate_netflow', - 1, - $config['activate_netflow'], - $rbt_disabled, - '', - '', - true - ) -); - -$table->data[1][] = html_print_label_input_block( __('Data storage path'), html_print_input_text('netflow_name_dir', $config['netflow_name_dir'], false, 50, 200, true) ); -$table->data[1][] = html_print_label_input_block( +$table->data[0][] = html_print_label_input_block( __('Daemon binary path'), html_print_input_text('netflow_daemon', $config['netflow_daemon'], false, 50, 200, true) ); -$table->data[2][] = html_print_label_input_block( +$table->data[1][] = html_print_label_input_block( __('Nfdump binary path'), html_print_input_text('netflow_nfdump', $config['netflow_nfdump'], false, 50, 200, true) ); -$table->data[2][] = html_print_label_input_block( +$table->data[1][] = html_print_label_input_block( __('Nfexpire binary path'), html_print_input_text('netflow_nfexpire', $config['netflow_nfexpire'], false, 50, 200, true) ); -$table->data[3][] = html_print_label_input_block( +$table->data[2][] = html_print_label_input_block( __('Maximum chart resolution'), html_print_input_text('netflow_max_resolution', $config['netflow_max_resolution'], false, 50, 200, true) ); -$table->data[3][] = html_print_label_input_block( +$table->data[2][] = html_print_label_input_block( __('Disable custom live view filters'), html_print_checkbox_switch('netflow_disable_custom_lvfilters', 1, $config['netflow_disable_custom_lvfilters'], true) ); -$table->data[4][] = html_print_label_input_block( +$table->data[3][] = html_print_label_input_block( __('Netflow max lifetime'), html_print_input_text('netflow_max_lifetime', $config['netflow_max_lifetime'], false, 50, 200, true) ); $onclick = "if (!confirm('".__('Warning').'. '.__('IP address resolution can take a lot of time')."')) return false;"; -$table->data[4][] = html_print_label_input_block( +$table->data[3][] = html_print_label_input_block( __('Name resolution for IP address'), html_print_checkbox_switch_extended('netflow_get_ip_hostname', 1, $config['netflow_get_ip_hostname'], false, $onclick, '', true) ); @@ -119,20 +98,7 @@ html_print_action_buttons( echo ''; ?> \ No newline at end of file diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 456d1c5158..1fe38aac0b 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -245,6 +245,10 @@ function config_update_config() $error_update[] = __('Enable GIS features'); } + if (config_update_value('activate_netflow', (bool) get_parameter('activate_netflow'), true) === false) { + $error_update[] = __('Enable Netflow'); + } + if (config_update_value('activate_sflow', (bool) get_parameter('activate_sflow'), true) === false) { $error_update[] = __('Enable Sflow'); } @@ -1575,10 +1579,6 @@ function config_update_config() break; case 'net': - if (config_update_value('activate_netflow', (bool) get_parameter('activate_netflow'), true) === false) { - $error_update[] = __('Enable Netflow'); - } - if (config_update_value('netflow_name_dir', get_parameter('netflow_name_dir'), true) === false) { $error_update[] = __('Name storage path'); } else {