2013-01-22 Ramon Novoa <rnovoa@artica.es>
* godmode/setup/setup_netflow.php, operation/netflow/nf_live_view.php, include/functions_config.php: Added support for disabling custom filters in the netflow live viewer. * include/functions_graph.php: Added min, max and avg values to unaggregated netflow charts. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7518 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
d0e63b7758
commit
0fcb8557c0
|
@ -1,3 +1,13 @@
|
|||
2013-01-22 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* godmode/setup/setup_netflow.php,
|
||||
operation/netflow/nf_live_view.php,
|
||||
include/functions_config.php: Added support for disabling custom
|
||||
filters in the netflow live viewer.
|
||||
|
||||
* include/functions_graph.php: Added min, max and avg values to
|
||||
unaggregated netflow charts.
|
||||
|
||||
2013-01-22 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_tags.php: Fix a empty value return
|
||||
|
|
|
@ -51,6 +51,9 @@ $table->data[3][0] = '<b>'.__('Nfdump binary path').'</b>';
|
|||
$table->data[3][1] = html_print_input_text ('netflow_nfdump', $config['netflow_nfdump'], false, 50, 200, true);
|
||||
$table->data[4][0] = '<b>'.__('Maximum chart resolution').'</b>' . ui_print_help_tip (__("Maximum number of points that a netflow area chart will display. The higher the resolution the performance. Values between 50 and 100 are recommended."), true);
|
||||
$table->data[4][1] = html_print_input_text ('netflow_max_resolution', $config['netflow_max_resolution'], false, 50, 200, true);
|
||||
$table->data[5][0] = '<b>'.__('Disable custom live view filters').'</b>' . ui_print_help_tip (__("Disable the definition of custom filters in the live view. Only existing filters can be used."), true);
|
||||
$table->data[5][1] = __('Yes').' '.html_print_radio_button ('netflow_disable_custom_lvfilters', 1, '', $config["netflow_disable_custom_lvfilters"], true).' ';
|
||||
$table->data[5][1] .= __('No').' '.html_print_radio_button ('netflow_disable_custom_lvfilters', 0, '', $config["netflow_disable_custom_lvfilters"], true).' ';
|
||||
|
||||
echo '<form id="netflow_setup" method="post">';
|
||||
|
||||
|
|
|
@ -300,6 +300,7 @@ function config_update_config () {
|
|||
config_update_value ('netflow_daemon', get_parameter ('netflow_daemon'));
|
||||
config_update_value ('netflow_nfdump', get_parameter ('netflow_nfdump'));
|
||||
config_update_value ('netflow_max_resolution', get_parameter ('netflow_max_resolution'));
|
||||
config_update_value ('netflow_disable_custom_lvfilters', get_parameter ('netflow_disable_custom_lvfilters'));
|
||||
break;
|
||||
case 'log':
|
||||
config_update_value ('log_dir', (string)get_parameter('log_dir'));
|
||||
|
|
|
@ -2835,13 +2835,33 @@ function graph_netflow_total_area ($data, $period, $width, $height, $unit = '',
|
|||
else {
|
||||
$chart_time_format = 'M d H\h';
|
||||
}
|
||||
|
||||
// Calculate min, max and avg values
|
||||
$avg = 0;
|
||||
foreach ($data as $timestamp => $value) {
|
||||
$max = $value['data'];
|
||||
$min = $value['data'];
|
||||
break;
|
||||
}
|
||||
|
||||
// Populate chart
|
||||
$count = 0;
|
||||
$chart = array ();
|
||||
foreach ($data as $timestamp => $value) {
|
||||
$chart[date ($chart_time_format, $timestamp)] = $value;
|
||||
if ($value['data'] > $max) {
|
||||
$max = $value['data'];
|
||||
}
|
||||
if ($value['data'] < $min) {
|
||||
$min = $value['data'];
|
||||
}
|
||||
$avg += $value['data'];
|
||||
$count++;
|
||||
}
|
||||
|
||||
if ($count > 0) {
|
||||
$avg /= $count;
|
||||
}
|
||||
|
||||
$flash_chart = $config['flash_charts'];
|
||||
if ($only_image) {
|
||||
$flash_chart = false;
|
||||
|
@ -2856,8 +2876,9 @@ function graph_netflow_total_area ($data, $period, $width, $height, $unit = '',
|
|||
|
||||
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
||||
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
|
||||
|
||||
return area_graph($flash_chart, $chart, $width, $height, array (), false,
|
||||
|
||||
$legend = array (__('Max.') . ' ' . format_numeric($max) . ' ' . __('Min.') . ' ' . format_numeric($min) . ' ' . __('Avg.') . ' ' . format_numeric ($avg));
|
||||
return area_graph($flash_chart, $chart, $width, $height, array (), $legend,
|
||||
array (), ui_get_full_url("images/image_problem.opaque.png"), "", "", $homeurl,
|
||||
$water_mark,
|
||||
$config['fontpath'], $config['font_size'], $unit, $ttl);
|
||||
|
|
|
@ -57,6 +57,9 @@ if (is_ajax()){
|
|||
$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);
|
||||
}
|
||||
|
@ -185,6 +188,7 @@ echo '<form method="post" action="' . $config['homeurl'] . 'index.php?sec=netf&s
|
|||
html_print_table ($table);
|
||||
|
||||
// Filter options table
|
||||
$i = 0;
|
||||
$table->width = '100%';
|
||||
$table->border = 0;
|
||||
$table->class = "databox_color";
|
||||
|
@ -192,59 +196,74 @@ echo '<form method="post" action="' . $config['homeurl'] . 'index.php?sec=netf&s
|
|||
$table->size[0] = '15%';
|
||||
$table->data = array ();
|
||||
|
||||
$table->data[0][0] = ui_print_error_message ('Define a name for the filter and click on Save as new filter again', '', true);
|
||||
$table->colspan[0][0] = 4;
|
||||
$table->data[$i][0] = ui_print_error_message ('Define a name for the filter and click on Save as new filter again', '', true);
|
||||
$table->colspan[$i][0] = 4;
|
||||
$table->rowstyle[$i] = 'display: none';
|
||||
$i++;
|
||||
|
||||
$table->data[1][0] = '<span id="filter_name_color"><b>'.__('Name').'</b></span>';
|
||||
$table->data[1][1] = html_print_input_text ('name', $filter['id_name'], false, 20, 80, true);
|
||||
$table->data[$i][0] = '<span id="filter_name_color"><b>'.__('Name').'</b></span>';
|
||||
$table->data[$i][1] = html_print_input_text ('name', $filter['id_name'], false, 20, 80, true);
|
||||
$own_info = get_user_info ($config['id_user']);
|
||||
$table->data[1][2] = '<span id="filter_group_color"><b>'.__('Group').'</b></span>';
|
||||
$table->data[1][3] = html_print_select_groups($config['id_user'], "IW", $own_info['is_admin'], 'assign_group', $filter['id_group'], '', '', -1, true, false, false);
|
||||
$table->data[$i][2] = '<span id="filter_group_color"><b>'.__('Group').'</b></span>';
|
||||
$table->data[$i][3] = html_print_select_groups($config['id_user'], "IW", $own_info['is_admin'], 'assign_group', $filter['id_group'], '', '', -1, true, false, false);
|
||||
$table->rowstyle[$i] = 'display: none';
|
||||
$i++;
|
||||
|
||||
$table->rowstyle[0] = 'display: none';
|
||||
$table->rowstyle[1] = 'display: none';
|
||||
|
||||
if ($config['netflow_disable_custom_lvfilters'] == 0) {
|
||||
// Read filter type
|
||||
if ($filter['advanced_filter'] != '') {
|
||||
$filter_type = 1;
|
||||
}
|
||||
else {
|
||||
$filter_type = 0;
|
||||
}
|
||||
|
||||
$table->data[$i][0] = '<b>'.__('Filter').'</b>';
|
||||
$table->data[$i][1] = __('Normal') . ' ' . html_print_radio_button_extended ('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'style="margin-right: 40px;"', true);
|
||||
$table->data[$i][1] .= __('Advanced') . ' ' . html_print_radio_button_extended ('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'style="margin-right: 40px;"', true);
|
||||
$table->data[$i][2] = '<b>'.__('Load filter').'</b>';
|
||||
$user_groups = users_get_groups ($config['id_user'], "AR", $own_info['is_admin'], true);
|
||||
$sql = "SELECT * FROM tnetflow_filter WHERE id_group IN (".implode(',', array_keys ($user_groups)).")";
|
||||
$table->data[$i][3] = html_print_select_from_sql ($sql, 'filter_id', $filter_id, '', __('none'), 0, true);
|
||||
$i++;
|
||||
|
||||
$table->data[$i][0] = __('Dst Ip'). ui_print_help_tip (__("Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249"), true);
|
||||
$table->data[$i][1] = html_print_input_text ('ip_dst', $filter['ip_dst'], false, 40, 80, true);
|
||||
$table->data[$i][2] = __('Src Ip'). ui_print_help_tip (__("Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249"), true);
|
||||
$table->data[$i][3] = html_print_input_text ('ip_src', $filter['ip_src'], false, 40, 80, true);
|
||||
$i++;
|
||||
|
||||
$table->data[$i][0] = __('Dst Port'). ui_print_help_tip (__("Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22"), true);
|
||||
$table->data[$i][1] = html_print_input_text ('dst_port', $filter['dst_port'], false, 40, 80, true);
|
||||
$table->data[$i][2] = __('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:<br>80,22"), true);
|
||||
$table->data[$i][3] = html_print_input_text ('src_port', $filter['src_port'], false, 40, 80, true);
|
||||
$i++;
|
||||
|
||||
$table->data[$i][0] = ui_print_help_icon ('pcap_filter', true);
|
||||
$table->data[$i][1] = html_print_textarea ('advanced_filter', 4, 40, $filter['advanced_filter'], "style='min-height: 0px;'", true);
|
||||
$table->colspan[$i][1] = 3;
|
||||
$i++;
|
||||
} else {
|
||||
$table->data[$i][0] = '<b>'.__('Load filter').'</b>';
|
||||
$user_groups = users_get_groups ($config['id_user'], "AR", $own_info['is_admin'], true);
|
||||
$sql = "SELECT * FROM tnetflow_filter WHERE id_group IN (".implode(',', array_keys ($user_groups)).")";
|
||||
$table->data[$i][1] = html_print_select_from_sql ($sql, 'filter_id', $filter_id, '', __('none'), 0, true);
|
||||
$table->data[$i][2] = '';
|
||||
$table->data[$i][3] = '';
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Read filter type
|
||||
if ($filter['advanced_filter'] != '') {
|
||||
$filter_type = 1;
|
||||
}
|
||||
else {
|
||||
$filter_type = 0;
|
||||
}
|
||||
|
||||
$table->data[2][0] = '<b>'.__('Filter').'</b>';
|
||||
$table->data[2][1] = __('Normal') . ' ' . html_print_radio_button_extended ('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'style="margin-right: 40px;"', true);
|
||||
$table->data[2][1] .= __('Advanced') . ' ' . html_print_radio_button_extended ('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'style="margin-right: 40px;"', true);
|
||||
$table->data[2][2] = '<b>'.__('Load filter').'</b>';
|
||||
$user_groups = users_get_groups ($config['id_user'], "AR", $own_info['is_admin'], true);
|
||||
$sql = "SELECT * FROM tnetflow_filter WHERE id_group IN (".implode(',', array_keys ($user_groups)).")";
|
||||
$table->data[2][3] = html_print_select_from_sql ($sql, 'filter_id', $filter_id, '', __('none'), 0, true);
|
||||
|
||||
|
||||
$table->data[3][0] = __('Dst Ip'). ui_print_help_tip (__("Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249"), true);
|
||||
$table->data[3][1] = html_print_input_text ('ip_dst', $filter['ip_dst'], false, 40, 80, true);
|
||||
$table->data[3][2] = __('Src Ip'). ui_print_help_tip (__("Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249"), true);
|
||||
$table->data[3][3] = html_print_input_text ('ip_src', $filter['ip_src'], false, 40, 80, true);
|
||||
|
||||
$table->data[4][0] = __('Dst Port'). ui_print_help_tip (__("Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22"), true);
|
||||
$table->data[4][1] = html_print_input_text ('dst_port', $filter['dst_port'], false, 40, 80, true);
|
||||
$table->data[4][2] = __('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:<br>80,22"), true);
|
||||
$table->data[4][3] = html_print_input_text ('src_port', $filter['src_port'], false, 40, 80, true);
|
||||
|
||||
$table->data[5][0] = ui_print_help_icon ('pcap_filter', true);
|
||||
$table->data[5][1] = html_print_textarea ('advanced_filter', 4, 40, $filter['advanced_filter'], "style='min-height: 0px;'", true);
|
||||
$table->colspan[5][1] = 3;
|
||||
|
||||
$table->data[6][0] = '<b>'.__('Aggregate by').'</b>'. ui_print_help_icon ('aggregate_by', true);
|
||||
|
||||
$table->data[$i][0] = '<b>'.__('Aggregate by').'</b>'. ui_print_help_icon ('aggregate_by', true);
|
||||
$aggregate_list = array();
|
||||
$aggregate_list = array ('none' => __('None'), 'proto' => __('Protocol'), 'srcip' =>__('Src Ip Address'), 'dstip' =>__('Dst Ip Address'), 'srcport' =>__('Src Port'), 'dstport' =>__('Dst Port') );
|
||||
$table->data[6][1] = html_print_select ($aggregate_list, "aggregate", $filter['aggregate'], '', '', 0, true, false, true, '', false);
|
||||
$table->data[$i][1] = html_print_select ($aggregate_list, "aggregate", $filter['aggregate'], '', '', 0, true, false, true, '', false);
|
||||
|
||||
$table->data[6][2] = '<b>'.__('Output format').'</b>';
|
||||
$table->data[$i][2] = '<b>'.__('Output format').'</b>';
|
||||
$show_output = array ('bytes' => __('Bytes'), 'bytespersecond' => __('Bytes per second'), 'kilobytes' => __('Kilobytes'), 'megabytes' => __('Megabytes'), 'kilobytespersecond' => __('Kilobytes per second'), 'megabytespersecond' => __('Megabytes per second'));
|
||||
$table->data[6][3] = html_print_select ($show_output, 'output', $filter['output'], '', '', 0, true, false, true, '', false);
|
||||
|
||||
$table->data[$i][3] = html_print_select ($show_output, 'output', $filter['output'], '', '', 0, true, false, true, '', false);
|
||||
$i++;
|
||||
|
||||
html_print_table ($table);
|
||||
|
||||
html_print_submit_button (__('Draw'), 'draw_button', false, 'class="sub upd"');
|
||||
|
|
Loading…
Reference in New Issue