Added pct to netflow explorer datas
Former-commit-id: 63907ccffb70dd2b2fc98cee065b2100d827ed2a
This commit is contained in:
parent
aecbdabbe0
commit
a191823d83
|
@ -1929,7 +1929,7 @@ function netflow_get_top_summary(
|
|||
$command = netflow_get_command($netflow_filter);
|
||||
|
||||
// Execute nfdump.
|
||||
$command .= " -q -o csv -n $max -s $sort/bytes -t ".date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
|
||||
$command .= " -o csv -n $max -s $sort/bytes -t ".date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
|
||||
exec($command, $result);
|
||||
|
||||
if (! is_array($result)) {
|
||||
|
@ -1940,6 +1940,11 @@ function netflow_get_top_summary(
|
|||
$result = array_reverse($result);
|
||||
array_pop($result);
|
||||
$result = array_reverse($result);
|
||||
// Get the globals.
|
||||
$globals = explode(',', array_pop($result));
|
||||
// Remove globals header.
|
||||
array_pop($result);
|
||||
array_pop($result);
|
||||
|
||||
$top_info = [];
|
||||
foreach ($result as $line) {
|
||||
|
@ -1957,6 +1962,9 @@ function netflow_get_top_summary(
|
|||
'sum_bytes' => $data[9],
|
||||
'sum_pkts' => $data[7],
|
||||
'sum_flows' => $data[5],
|
||||
'pct_bytes' => number_format((($data[9] / $globals[1]) * 100), 2),
|
||||
'pct_pkts' => number_format((($data[7] / $globals[2]) * 100), 2),
|
||||
'pct_flows' => number_format((($data[5] / $globals[0]) * 100), 2),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -249,9 +249,14 @@ foreach ($data as $item) {
|
|||
$row['main'] .= '</div>';
|
||||
if (!$is_network) {
|
||||
$row['flows'] = format_for_graph($item['sum_flows'], 2);
|
||||
$row['flows'] .= ' ('.$item['pct_flows'].'%)';
|
||||
}
|
||||
|
||||
$row['pkts'] = format_for_graph($item['sum_pkts'], 2);
|
||||
if (!$is_network) {
|
||||
$row['pkts'] .= ' ('.$item['pct_pkts'].'%)';
|
||||
}
|
||||
|
||||
$row['bytes'] = format_for_graph(
|
||||
$item['sum_bytes'],
|
||||
2,
|
||||
|
@ -260,6 +265,10 @@ foreach ($data as $item) {
|
|||
1024,
|
||||
'B'
|
||||
);
|
||||
if (!$is_network) {
|
||||
$row['bytes'] .= ' ('.$item['pct_bytes'].'%)';
|
||||
}
|
||||
|
||||
$table->data[] = $row;
|
||||
|
||||
// Build the pie graph data structure.
|
||||
|
|
Loading…
Reference in New Issue