From 30baabafeb7339974e8d56bffd38e6987b6f14c7 Mon Sep 17 00:00:00 2001 From: m-lopez-f Date: Thu, 23 Feb 2017 09:05:11 +0100 Subject: [PATCH] Fixed problems with output data in netflow, change max view data. Gitlab: #333 --- pandora_console/include/functions_netflow.php | 2 +- .../operation/netflow/nf_live_view.php | 58 +++++++++++-------- 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/pandora_console/include/functions_netflow.php b/pandora_console/include/functions_netflow.php index eb10cbc9d9..75b9d1e386 100644 --- a/pandora_console/include/functions_netflow.php +++ b/pandora_console/include/functions_netflow.php @@ -469,7 +469,7 @@ function netflow_get_data ($start_date, $end_date, $interval_length, $filter, $a // Parse aggregates foreach ($string as $line) { - if ($line=='') { + if ($line == '') { continue; } $val = explode(',',$line); diff --git a/pandora_console/operation/netflow/nf_live_view.php b/pandora_console/operation/netflow/nf_live_view.php index ab880752f3..e917993c68 100644 --- a/pandora_console/operation/netflow/nf_live_view.php +++ b/pandora_console/operation/netflow/nf_live_view.php @@ -83,7 +83,7 @@ $filter['router_ip'] = get_parameter('router_ip'); // Read chart configuration $chart_type = get_parameter('chart_type', 'netflow_area'); -$max_aggregates = (int) get_parameter('max_aggregates', 0); +$max_aggregates = (int) get_parameter('max_aggregates', 1); $period = (int) get_parameter('period', SECONDS_1DAY); $update_date = (int) get_parameter('update_date', 0); $date = get_parameter_post ('date', date (DATE_FORMAT, get_system_time ())); @@ -103,9 +103,10 @@ $update = get_parameter('update_button', ''); $end_date = strtotime ($date . " " . $time); $start_date = $end_date - $period; -if (! defined ('METACONSOLE')) { +if (!is_metaconsole()) { //Header - ui_print_page_header (__('Netflow live view'), "images/op_netflow.png", false, "", false, array ()); + ui_print_page_header (__('Netflow live view'), + "images/op_netflow.png", false, "", false, array ()); $is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'; if ($is_windows) { @@ -126,7 +127,6 @@ if (! defined ('METACONSOLE')) { ui_print_error_message(sprintf(__('Make sure nfdump version 1.6.8 or newer is installed!'))); } } - } else { $nav_bar = array(array('link' => 'index.php?sec=main', 'text' => __('Main')), @@ -181,18 +181,20 @@ enterprise_hook('open_meta_frame'); $class = "databox filters"; -echo '
'; +echo ''; + echo ""; - if (defined("METACONSOLE")) { - echo " - - - - "; - } - if (defined ('METACONSOLE')) { + if (is_metaconsole()) { + echo " + + + + "; + $list_servers = array(); $servers = db_get_all_rows_sql ("SELECT * @@ -250,7 +252,8 @@ echo '"; echo ""; - echo ""; + echo ""; echo ""; $max_values = array ('2' => '2', @@ -267,10 +270,18 @@ echo '"; echo ""; - $onclick = "if (!confirm('".__('Warning').". ".__('IP address resolution can take a lot of time')."')) return false;"; - $radio_buttons = __('Yes').'  '.html_print_radio_button_extended ('address_resolution', 1, '', $address_resolution, false, $onclick, '', true).'   '; - $radio_buttons .= __('No').'  '.html_print_radio_button ('address_resolution', 0, '', $address_resolution, true); - echo ""; + $onclick = "if (!confirm('".__('Warning') . ". " . + __('IP address resolution can take a lot of time') . + "')) return false;"; + $radio_buttons = __('Yes').'  ' . + html_print_radio_button_extended ('address_resolution', 1, '', + $address_resolution, false, $onclick, '', true) . + '   '; + $radio_buttons .= __('No').'  ' . + html_print_radio_button ('address_resolution', 0, '', + $address_resolution, true); + echo ""; echo ""; echo ""; @@ -292,7 +303,8 @@ echo '"; echo ""; - echo ""; + echo ""; $own_info = get_user_info ($config['id_user']); echo ""; echo ""; @@ -364,7 +376,7 @@ echo '"; } else { - echo ""; + echo ""; echo ""; } @@ -382,7 +394,7 @@ echo '"; echo ""; - echo ""; + echo ""; $aggregate_list = array(); $aggregate_list = array ('none' => __('None'), 'proto' => __('Protocol'), 'srcip' =>__('Src Ip Address'), 'dstip' =>__('Dst Ip Address'), 'srcport' =>__('Src Port'), 'dstport' =>__('Dst Port') ); echo "";
- " . __('Draw live filter') . " -
+ " . __('Draw live filter') . " +
" . '' . __('Type') . '' . "" . html_print_select (netflow_get_chart_types (), 'chart_type', $chart_type,'','',0,true) . "" . html_print_select (netflow_get_chart_types (), + 'chart_type', $chart_type,'','',0,true) . "" . '' . __('Max. values') . '' . "" . ''.__('IP address resolution').'' . ui_print_help_tip (__("Resolve the IP addresses to get their hostnames."), true) . "" . ''.__('IP address resolution').'' . + ui_print_help_tip (__("Resolve the IP addresses to get their hostnames."), true) . "$radio_buttons
" . ''.__('Name').'' . "" . html_print_input_text ('name', $filter['id_name'], false, 20, 80, true) . "" . html_print_input_text ('name', + $filter['id_name'], false, 20, 80, true) . "" . ''.__('Group').'' . "" . html_print_select_groups($config['id_user'], "IW", $own_info['is_admin'], 'assign_group', $filter['id_group'], '', '', -1, true, false, false) . "" . __('Src Port'). ui_print_help_tip (__("Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:
80,22"), true) . "
" . __('Src Port') . ui_print_help_tip (__("Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:
80,22"), true) . "
" . html_print_input_text ('src_port', $filter['src_port'], false, 30, 80, true) . "
" . ''.__('Aggregate by').''. ui_print_help_icon ('aggregate_by', true) . "" . '' . __('Aggregate by') . '' . ui_print_help_icon ('aggregate_by', true) . "" . html_print_select ($aggregate_list, "aggregate", $filter['aggregate'], '', '', 0, true, false, true, '', false) . "