[Netflow live] Removed agregate by none
Former-commit-id: 4da1581da67c95f29b9b34eb70436e8f68706988
This commit is contained in:
parent
8a336d6cfe
commit
3d1f1f86ed
|
@ -94,7 +94,7 @@ if ($id) {
|
||||||
$ip_src = '';
|
$ip_src = '';
|
||||||
$dst_port = '';
|
$dst_port = '';
|
||||||
$src_port = '';
|
$src_port = '';
|
||||||
$aggregate = 'none';
|
$aggregate = 'dstip';
|
||||||
$output = 'bytes';
|
$output = 'bytes';
|
||||||
$advanced_filter = '';
|
$advanced_filter = '';
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ if ($update) {
|
||||||
if ($create) {
|
if ($create) {
|
||||||
$name = (string) get_parameter('name');
|
$name = (string) get_parameter('name');
|
||||||
$assign_group = (int) get_parameter('assign_group');
|
$assign_group = (int) get_parameter('assign_group');
|
||||||
$aggregate = get_parameter('aggregate', 'none');
|
$aggregate = get_parameter('aggregate', 'dstip');
|
||||||
$output = get_parameter('output', 'bytes');
|
$output = get_parameter('output', 'bytes');
|
||||||
$ip_dst = get_parameter('ip_dst', '');
|
$ip_dst = get_parameter('ip_dst', '');
|
||||||
$ip_src = get_parameter('ip_src', '');
|
$ip_src = get_parameter('ip_src', '');
|
||||||
|
@ -241,7 +241,6 @@ $table->data[7][1] = html_print_textarea('advanced_filter', 4, 40, $advanced_fil
|
||||||
|
|
||||||
$table->data[8][0] = '<b>'.__('Aggregate by').'</b>'.ui_print_help_icon('aggregate_by', true);
|
$table->data[8][0] = '<b>'.__('Aggregate by').'</b>'.ui_print_help_icon('aggregate_by', true);
|
||||||
$aggregate_list = [
|
$aggregate_list = [
|
||||||
'none' => __('None'),
|
|
||||||
'proto' => __('Protocol'),
|
'proto' => __('Protocol'),
|
||||||
'srcip' => __('Src Ip Address'),
|
'srcip' => __('Src Ip Address'),
|
||||||
'dstip' => __('Dst Ip Address'),
|
'dstip' => __('Dst Ip Address'),
|
||||||
|
|
|
@ -506,7 +506,6 @@ function netflow_get_data($start_date, $end_date, $interval_length, $filter, $ag
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is aggregation calculate the top n
|
// If there is aggregation calculate the top n
|
||||||
if ($aggregate != 'none') {
|
|
||||||
$values['data'] = [];
|
$values['data'] = [];
|
||||||
$values['sources'] = [];
|
$values['sources'] = [];
|
||||||
|
|
||||||
|
@ -568,9 +567,6 @@ function netflow_get_data($start_date, $end_date, $interval_length, $filter, $ag
|
||||||
',',
|
',',
|
||||||
array_keys($values['sources'])
|
array_keys($values['sources'])
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
$values = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Address resolution start
|
// Address resolution start
|
||||||
$get_hostnames = false;
|
$get_hostnames = false;
|
||||||
|
@ -605,35 +601,6 @@ function netflow_get_data($start_date, $end_date, $interval_length, $filter, $ag
|
||||||
|
|
||||||
$interval_end = $intervals[($k + 1)];
|
$interval_end = $intervals[($k + 1)];
|
||||||
|
|
||||||
if ($aggregate == 'none') {
|
|
||||||
$data = netflow_get_summary($interval_start, $interval_end, $filter, $connection_name);
|
|
||||||
if (! isset($data['totalbytes'])) {
|
|
||||||
$values[$interval_start]['data'] = 0;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($unit) {
|
|
||||||
case 'megabytes':
|
|
||||||
$values[$interval_start]['data'] = ($data['totalbytes'] / 1048576);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'megabytespersecond':
|
|
||||||
$values[$interval_start]['data'] = ($data['avgbps'] / 1048576 / 8);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'kilobytes':
|
|
||||||
$values[$interval_start]['data'] = ($data['totalbytes'] / 1024);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'kilobytespersecond':
|
|
||||||
$values[$interval_start]['data'] = ($data['avgbps'] / 1024 / 8);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
$values[$interval_start]['data'] = $data['totalbytes'];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Set default values
|
// Set default values
|
||||||
foreach ($values['sources'] as $source => $discard) {
|
foreach ($values['sources'] as $source => $discard) {
|
||||||
$values['data'][$interval_end][$source] = 0;
|
$values['data'][$interval_end][$source] = 0;
|
||||||
|
@ -685,9 +652,8 @@ function netflow_get_data($start_date, $end_date, $interval_length, $filter, $ag
|
||||||
$values['data'][$interval_end][$line['agg']] = $line['data'];
|
$values['data'][$interval_end][$line['agg']] = $line['data'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (($aggregate != 'none') && (empty($values['data']))) {
|
if (empty($values['data'])) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1207,7 +1173,6 @@ function netflow_draw_item($start_date, $end_date, $interval_length, $type, $fil
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aggregate != 'none') {
|
|
||||||
if ($output == 'HTML') {
|
if ($output == 'HTML') {
|
||||||
$html = '<b>'.__('Unit').':</b> '.netflow_format_unit($unit);
|
$html = '<b>'.__('Unit').':</b> '.netflow_format_unit($unit);
|
||||||
$html .= ' <b>'.__('Aggregate').':</b> '.netflow_format_aggregate($aggregate);
|
$html .= ' <b>'.__('Aggregate').':</b> '.netflow_format_aggregate($aggregate);
|
||||||
|
@ -1233,30 +1198,6 @@ function netflow_draw_item($start_date, $end_date, $interval_length, $type, $fil
|
||||||
$xml .= netflow_aggregate_area_xml($data);
|
$xml .= netflow_aggregate_area_xml($data);
|
||||||
return $xml;
|
return $xml;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if ($output == 'HTML') {
|
|
||||||
$html = '<b>'.__('Unit').':</b> '.netflow_format_unit($unit);
|
|
||||||
if ($interval_length != 0) {
|
|
||||||
$html .= ' <b>'._('Resolution').":</b> $interval_length ".__('seconds');
|
|
||||||
}
|
|
||||||
|
|
||||||
$html .= graph_netflow_total_area($data, $interval, 660, 320, netflow_format_unit($unit));
|
|
||||||
return $html;
|
|
||||||
} else if ($output == 'PDF') {
|
|
||||||
$html = '<b>'.__('Unit').':</b> '.netflow_format_unit($unit);
|
|
||||||
if ($interval_length != 0) {
|
|
||||||
$html .= ' <b>'._('Resolution').":</b> $interval_length ".__('seconds');
|
|
||||||
}
|
|
||||||
|
|
||||||
$html .= graph_netflow_total_area($data, $interval, 660, 320, netflow_format_unit($unit), 2, true);
|
|
||||||
return $html;
|
|
||||||
} else if ($output == 'XML') {
|
|
||||||
$xml = "<unit>$unit</unit>\n";
|
|
||||||
$xml .= "<resolution>$interval_length</resolution>\n";
|
|
||||||
$xml .= netflow_total_area_xml($data);
|
|
||||||
return $xml;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '2':
|
case '2':
|
||||||
|
|
|
@ -310,7 +310,6 @@ if (is_metaconsole()) {
|
||||||
echo '<td><b>'.__('Aggregate by').'</b>'.ui_print_help_icon('aggregate_by', true).'</td>';
|
echo '<td><b>'.__('Aggregate by').'</b>'.ui_print_help_icon('aggregate_by', true).'</td>';
|
||||||
$aggregate_list = [];
|
$aggregate_list = [];
|
||||||
$aggregate_list = [
|
$aggregate_list = [
|
||||||
'none' => __('None'),
|
|
||||||
'proto' => __('Protocol'),
|
'proto' => __('Protocol'),
|
||||||
'srcip' => __('Src Ip Address'),
|
'srcip' => __('Src Ip Address'),
|
||||||
'dstip' => __('Dst Ip Address'),
|
'dstip' => __('Dst Ip Address'),
|
||||||
|
|
Loading…
Reference in New Issue