$id)); if (empty($advanced_filter)) $type = 0; else $type = 1; echo $type; } // Get values of the current netflow filter if ($get_filter_values) { $id = get_parameter('id'); $filter_values = db_get_row_filter ('tnetflow_filter', array('id_sg' => $id)); // Decode HTML entities $filter_values['advanced_filter'] = io_safe_output ($filter_values['advanced_filter']); echo json_encode($filter_values); } return; } // Read filter configuration $filter_id = (int) get_parameter ('filter_id', 0); $filter['id_name'] = get_parameter ('name', ''); $filter['id_group'] = (int) get_parameter ('assign_group', 0); $filter['aggregate'] = get_parameter('aggregate',''); $filter['output'] = get_parameter('output','bytes'); $filter['ip_dst'] = get_parameter('ip_dst',''); $filter['ip_src'] = get_parameter('ip_src',''); $filter['dst_port'] = get_parameter('dst_port',''); $filter['src_port'] = get_parameter('src_port',''); $filter['advanced_filter'] = get_parameter('advanced_filter',''); $filter['advanced_filter'] = get_parameter('advanced_filter',''); // Read chart configuration $chart_type = get_parameter('chart_type', 'netflow_area'); $max_aggregates = (int) get_parameter('max_aggregates', 0); $period = (int) get_parameter('period', '86400'); $update_date = (int) get_parameter('update_date', 0); $date = get_parameter_post ('date', date (DATE_FORMAT, get_system_time ())); $time = get_parameter_post ('time', date (TIME_FORMAT, get_system_time ())); $connection_name = get_parameter('connection_name', ''); $interval_length = (int) get_parameter('interval_length', 300); // Read buttons $draw = get_parameter('draw_button', ''); $save = get_parameter('save_button', ''); $update = get_parameter('update_button', ''); // Calculate start and end dates $end_date = strtotime ($date . " " . $time); $start_date = $end_date - $period; if (! defined ('METACONSOLE')) { //Header ui_print_page_header (__('Netflow live view'), "images/op_netflow.png", false, "", false, array ()); // Check the nfdump binary $check_result = netflow_check_nfdump_binary ($config['netflow_nfdump']); // Not found or not executable if ($check_result == 1) { ui_print_error_message( sprintf(__('nfdump binary (%s) not found!'), $config['netflow_nfdump'])); } // Wrong version else if ($check_result == 2) { 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')), array('link' => 'index.php?sec=netf&sec2=operation/netflow/nf_live_view', 'text' => __('Netflow live view'))); ui_meta_print_page_header($nav_bar); ui_meta_print_header(__("Netflow live view")); } // Save user defined filter if ($save != '' && check_acl ($config["id_user"], 0, "AW")) { // Save filter args $filter['filter_args'] = netflow_get_filter_arguments ($filter); $filter_id = db_process_sql_insert ('tnetflow_filter', $filter); if ($filter_id === false) { $filter_id = 0; ui_print_error_message(__ ('Error creating filter')); } else { ui_print_success_message(__ ('Filter created successfully')); } } // Update current filter else if ($update != '' && check_acl ($config["id_user"], 0, "AW")) { // Do not update the filter name and group $filter_copy = $filter; unset ($filter_copy['id_name']); unset ($filter_copy['id_group']); // Save filter args $filter_copy['filter_args'] = netflow_get_filter_arguments ($filter_copy); $result = db_process_sql_update ('tnetflow_filter', $filter_copy, array('id_sg' => $filter_id)); ui_print_result_message ($result, __('Filter updated successfully'), __('Error updating filter')); } // The filter name will not be needed anymore $filter['id_name'] = ''; $netflow_disable_custom_lvfilters = false; if (isset($config['netflow_disable_custom_lvfilters'])) { $netflow_disable_custom_lvfilters = $config['netflow_disable_custom_lvfilters']; } enterprise_hook('open_meta_frame'); echo '
'; if ($draw != '') { // Get the command to call nfdump $command = netflow_get_command ($filter); // Draw echo "