mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Added filter to ntop part in network explorer
Former-commit-id: 688f737c26599da309ed414f4291e24e521d74a0
This commit is contained in:
parent
ed25536a97
commit
fbd5648d60
@ -24,17 +24,25 @@
|
|||||||
/**
|
/**
|
||||||
* Get the tnetwok_matrix summatory data.
|
* Get the tnetwok_matrix summatory data.
|
||||||
*
|
*
|
||||||
* @param integer $top Number of hosts to show.
|
* @param integer $top Number of hosts to show.
|
||||||
* @param boolean $talker Talker (true) or listetener (false).
|
* @param boolean $talker Talker (true) or listetener (false).
|
||||||
* @param integer $start Utimestamp of start time.
|
* @param integer $start Utimestamp of start time.
|
||||||
* @param integer $end Utimestamp of end time.
|
* @param integer $end Utimestamp of end time.
|
||||||
* @param string $ip_filter Ip to filter.
|
* @param string $ip_filter Ip to filter.
|
||||||
|
* @param boolean $order_by_bytes True by top by bytes. False by packets.
|
||||||
*
|
*
|
||||||
* @return array With requested data.
|
* @return array With requested data.
|
||||||
*/
|
*/
|
||||||
function network_matrix_get_top($top, $talker, $start, $end, $ip_filter='')
|
function network_matrix_get_top(
|
||||||
{
|
$top,
|
||||||
|
$talker,
|
||||||
|
$start,
|
||||||
|
$end,
|
||||||
|
$ip_filter='',
|
||||||
|
$order_by_bytes=true
|
||||||
|
) {
|
||||||
$field_to_group = ($talker === true) ? 'source' : 'destination';
|
$field_to_group = ($talker === true) ? 'source' : 'destination';
|
||||||
|
$field_to_order = ($order_by_bytes === true) ? 'sum_bytes' : 'sum_pkts';
|
||||||
$filter_sql = '';
|
$filter_sql = '';
|
||||||
if (!empty($ip_filter)) {
|
if (!empty($ip_filter)) {
|
||||||
$filter_field = ($talker === true) ? 'destination' : 'source';
|
$filter_field = ($talker === true) ? 'destination' : 'source';
|
||||||
@ -47,13 +55,14 @@ function network_matrix_get_top($top, $talker, $start, $end, $ip_filter='')
|
|||||||
WHERE utimestamp > %d AND utimestamp < %d
|
WHERE utimestamp > %d AND utimestamp < %d
|
||||||
%s
|
%s
|
||||||
GROUP BY %s
|
GROUP BY %s
|
||||||
ORDER BY sum_bytes DESC
|
ORDER BY %s DESC
|
||||||
LIMIT %d',
|
LIMIT %d',
|
||||||
$field_to_group,
|
$field_to_group,
|
||||||
$start,
|
$start,
|
||||||
$end,
|
$end,
|
||||||
$filter_sql,
|
$filter_sql,
|
||||||
$field_to_group,
|
$field_to_group,
|
||||||
|
$field_to_order,
|
||||||
$top
|
$top
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -150,7 +150,8 @@ if ($is_network) {
|
|||||||
$action === 'talkers',
|
$action === 'talkers',
|
||||||
$utimestamp_lower,
|
$utimestamp_lower,
|
||||||
$utimestamp_greater,
|
$utimestamp_greater,
|
||||||
$main_value
|
$main_value,
|
||||||
|
$order_by !== 'pkts'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$data = netflow_get_top_summary(
|
$data = netflow_get_top_summary(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user