[Netflow usage map] Added data to show
Former-commit-id: ca4db091b4c0f40061b9f7b8f13c4fe915ce022e
This commit is contained in:
parent
1dceb93a76
commit
d37acbb159
|
@ -1794,10 +1794,11 @@ function netflow_aggregate_is_ip($aggregate)
|
|||
* @param integer $start_date Time in timestamp format.
|
||||
* @param integer $end_date Time in timestamp format.
|
||||
* @param integer $top Max data to show.
|
||||
* @param integer $aggregate One of dstip or srcip.
|
||||
*
|
||||
* @return array With map structure.
|
||||
*/
|
||||
function netflow_build_map_data($start_date, $end_date, $top)
|
||||
function netflow_build_map_data($start_date, $end_date, $top, $aggregate)
|
||||
{
|
||||
$data = netflow_get_relationships_raw_data(
|
||||
$start_date,
|
||||
|
@ -1805,7 +1806,7 @@ function netflow_build_map_data($start_date, $end_date, $top)
|
|||
[
|
||||
'id_name' => '',
|
||||
'id_group' => 0,
|
||||
'aggregate' => 'srcip',
|
||||
'aggregate' => $aggregate,
|
||||
'id_dst' => '',
|
||||
'ip_src' => '',
|
||||
'dst_port' => '',
|
||||
|
@ -1814,7 +1815,7 @@ function netflow_build_map_data($start_date, $end_date, $top)
|
|||
'router_ip' => '',
|
||||
],
|
||||
$top,
|
||||
'srcip'
|
||||
$aggregate
|
||||
);
|
||||
|
||||
$nodes = array_map(
|
||||
|
|
|
@ -92,7 +92,7 @@ function network_matrix_get_top(
|
|||
*
|
||||
* @return array With the actions to print in a select.
|
||||
*/
|
||||
function network_get_report_actions($network)
|
||||
function network_get_report_actions($network=true)
|
||||
{
|
||||
$common_actions = [
|
||||
'listeners' => __('Top listeners'),
|
||||
|
@ -172,15 +172,16 @@ function network_format_bytes($value)
|
|||
/**
|
||||
* Build netflow data structure to network map.
|
||||
*
|
||||
* @param integer $start Time in timestamp format.
|
||||
* @param integer $end Time in timestamp format.
|
||||
* @param integer $top Max data to show.
|
||||
* @param integer $start Time in timestamp format.
|
||||
* @param integer $end Time in timestamp format.
|
||||
* @param integer $top Max data to show.
|
||||
* @param boolean $talker True to get top tolkers. False for listeners.
|
||||
*
|
||||
* @return array With map structure.
|
||||
*/
|
||||
function network_build_map_data($start, $end, $top)
|
||||
function network_build_map_data($start, $end, $top, $talker)
|
||||
{
|
||||
$data = network_matrix_get_top($top, true, $start, $end);
|
||||
$data = network_matrix_get_top($top, $talker, $start, $end);
|
||||
|
||||
$hosts = array_map(
|
||||
function ($elem) {
|
||||
|
@ -207,7 +208,7 @@ function network_build_map_data($start, $end, $top)
|
|||
foreach ($hosts as $host) {
|
||||
$host_top = network_matrix_get_top(
|
||||
$top,
|
||||
false,
|
||||
!$talker,
|
||||
$start,
|
||||
$end,
|
||||
$host,
|
||||
|
|
|
@ -40,6 +40,7 @@ if (! check_acl($config['id_user'], 0, 'AR')) {
|
|||
ui_include_time_picker();
|
||||
|
||||
// Query params and other initializations.
|
||||
$action = get_parameter('action', 'talkers');
|
||||
$time_greater = get_parameter('time_greater', date(TIME_FORMAT));
|
||||
$date_greater = get_parameter('date_greater', date(DATE_FORMAT));
|
||||
$utimestamp_greater = strtotime($date_greater.' '.$time_greater);
|
||||
|
@ -114,7 +115,17 @@ $table->data['0']['2'] .= html_print_select(
|
|||
true
|
||||
);
|
||||
|
||||
$table->data['1']['0'] = '';
|
||||
|
||||
$table->data['1']['0'] = __('Data to show').' ';
|
||||
$table->data['1']['0'] .= html_print_select(
|
||||
network_get_report_actions(),
|
||||
'action',
|
||||
$action,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
);
|
||||
$table->data['1']['1'] = '';
|
||||
|
||||
$netflow_button = '';
|
||||
|
@ -158,14 +169,16 @@ if ((bool) get_parameter('update_netflow') === true) {
|
|||
$map_data = netflow_build_map_data(
|
||||
$utimestamp_lower,
|
||||
$utimestamp_greater,
|
||||
$top
|
||||
$top,
|
||||
($action === 'talkers') ? 'srcip' : 'dstip'
|
||||
);
|
||||
$has_data = !empty($map_data['nodes']);
|
||||
} else if ((bool) get_parameter('update_nta') === true) {
|
||||
$map_data = network_build_map_data(
|
||||
$utimestamp_lower,
|
||||
$utimestamp_greater,
|
||||
$top
|
||||
$top,
|
||||
$action === 'talkers'
|
||||
);
|
||||
$has_data = !empty($map_data['nodes']);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue