mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Added top by other metric in netflow report
Former-commit-id: 48f5b58ea255c59ffaa109805032c1b35de61a48
This commit is contained in:
parent
e9061d74b6
commit
ed25536a97
@ -1876,6 +1876,7 @@ function netflow_check_nfdump_binary($nfdump_binary)
|
|||||||
* @param integer $start_date In utimestamp.
|
* @param integer $start_date In utimestamp.
|
||||||
* @param integer $end_date In utimestamp.
|
* @param integer $end_date In utimestamp.
|
||||||
* @param string $filter Ip to filter.
|
* @param string $filter Ip to filter.
|
||||||
|
* @param string $order Select one of bytes,pkts,flow.
|
||||||
*
|
*
|
||||||
* @return array With data (host, sum_bytes, sum_pkts and sum_flows).
|
* @return array With data (host, sum_bytes, sum_pkts and sum_flows).
|
||||||
*/
|
*/
|
||||||
@ -1884,7 +1885,8 @@ function netflow_get_top_summary(
|
|||||||
$top_action,
|
$top_action,
|
||||||
$start_date,
|
$start_date,
|
||||||
$end_date,
|
$end_date,
|
||||||
$filter=''
|
$filter='',
|
||||||
|
$order='bytes'
|
||||||
) {
|
) {
|
||||||
global $nfdump_date_format;
|
global $nfdump_date_format;
|
||||||
$netflow_filter = [];
|
$netflow_filter = [];
|
||||||
@ -1929,7 +1931,23 @@ function netflow_get_top_summary(
|
|||||||
$command = netflow_get_command($netflow_filter);
|
$command = netflow_get_command($netflow_filter);
|
||||||
|
|
||||||
// Execute nfdump.
|
// Execute nfdump.
|
||||||
$command .= " -o csv -n $max -s $sort/bytes -t ".date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
|
$order_text = '';
|
||||||
|
switch ($order) {
|
||||||
|
case 'flows':
|
||||||
|
$order_text = 'flows';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'pkts':
|
||||||
|
$order_text = 'packets';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'bytes':
|
||||||
|
default:
|
||||||
|
$order_text = 'bytes';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$command .= " -o csv -n $max -s $sort/$order_text -t ".date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
|
||||||
exec($command, $result);
|
exec($command, $result);
|
||||||
|
|
||||||
if (! is_array($result)) {
|
if (! is_array($result)) {
|
||||||
|
@ -158,7 +158,8 @@ if ($is_network) {
|
|||||||
$action,
|
$action,
|
||||||
$utimestamp_lower,
|
$utimestamp_lower,
|
||||||
$utimestamp_greater,
|
$utimestamp_greater,
|
||||||
$main_value
|
$main_value,
|
||||||
|
$order_by
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user