mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
Fixed detailed host traffic chart
Former-commit-id: abdf6f9d171facf53260d90f28204d1e81bbeaf4
This commit is contained in:
parent
bc9192b98a
commit
f32e022b1b
@ -1246,8 +1246,16 @@ function netflow_draw_item(
|
|||||||
return $html;
|
return $html;
|
||||||
|
|
||||||
case 'netflow_host_treemap':
|
case 'netflow_host_treemap':
|
||||||
$netflow_data = netflow_get_record($start_date, $end_date, $filter, $max_aggregates, $address_resolution);
|
$data_stats = netflow_get_stats(
|
||||||
|
$start_date,
|
||||||
|
$end_date,
|
||||||
|
$filter,
|
||||||
|
$aggregate,
|
||||||
|
$max_aggregates,
|
||||||
|
true,
|
||||||
|
$connection_name,
|
||||||
|
$address_resolution
|
||||||
|
);
|
||||||
switch ($aggregate) {
|
switch ($aggregate) {
|
||||||
case 'srcip':
|
case 'srcip':
|
||||||
case 'srcport':
|
case 'srcport':
|
||||||
@ -1265,48 +1273,27 @@ function netflow_draw_item(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data_aux = [];
|
$data_graph = [
|
||||||
foreach ($netflow_data as $record) {
|
'name' => __('Host detailed traffic').': '.$type,
|
||||||
$address = $record[$address_type];
|
'children' => [],
|
||||||
$port = $record[$port_type];
|
];
|
||||||
|
|
||||||
if (!isset($data_aux[$address])) {
|
|
||||||
$data_aux[$address] = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($data_aux[$address][$port])) {
|
|
||||||
$data_aux[$address][$port] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data_aux[$address][$port] += $record['data'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = -1;
|
$id = -1;
|
||||||
|
|
||||||
$data = [];
|
foreach ($data_stats as $sdata) {
|
||||||
|
$data_graph['children'][] = [
|
||||||
if (! empty($netflow_data)) {
|
'id' => $i++,
|
||||||
$data['name'] = __('Host detailed traffic').': '.$type;
|
'name' => $sdata['agg'],
|
||||||
$data['children'] = [];
|
'children' => [
|
||||||
|
[
|
||||||
foreach ($data_aux as $address => $ports) {
|
'id' => $i++,
|
||||||
$children = [];
|
'name' => $sdata['agg'],
|
||||||
$children['id'] = $id++;
|
'value' => $sdata['data'],
|
||||||
$children['name'] = $address;
|
'tooltip_content' => network_format_bytes($sdata['data']),
|
||||||
$children['children'] = [];
|
],
|
||||||
foreach ($ports as $port => $value) {
|
],
|
||||||
$children_data = [];
|
];
|
||||||
$children_data['id'] = $id++;
|
|
||||||
$children_data['name'] = $port;
|
|
||||||
$children_data['value'] = $value;
|
|
||||||
$children_data['tooltip_content'] = $port.': <b>'.network_format_bytes($value).'</b>';
|
|
||||||
$children['children'][] = $children_data;
|
|
||||||
}
|
}
|
||||||
|
return graph_netflow_host_traffic($data_graph, 'auto', 400);
|
||||||
$data['children'][] = $children;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return graph_netflow_host_traffic($data, 'auto', 400);
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user