'stats']) . '" iOCd = "FlowStats" method = "SUBMIT">';
echo 'Top N:
During the last:
, Stat Type:
, Order By:
';
echo '';
print_optionbar_end();
// process stuff now if we the button was clicked on
if (isset($vars['process'])) {
// Make sure we have a sane value for lastN
$lastN = 900;
if (isset($vars['lastN']) &&
is_numeric($vars['lastN']) &&
($vars['lastN'] <= \LibreNMS\Config::get('nfsen_last_max'))
) {
$lastN = $vars['lastN'];
}
// Make sure we have a sane value for lastN
$topN = 20; // The default if not set or something invalid is set
if (isset($vars['topN']) &&
is_numeric($vars['topN']) &&
($vars['topN'] <= \LibreNMS\Config::get('nfsen_top_max'))
) {
$topN = $vars['topN'];
}
// Handle the stat order.
$stat_order = 'pps'; // The default if not set or something invalid is set
if (isset($vars['statorder']) && isset($order_types[$vars['statorder']])) {
$stat_order = $vars['statorder'];
}
// Handle the stat type.
$stat_type = 'srcip'; // The default if not set or something invalid is set
if (isset($vars['stattype']) && isset($stat_types[$vars['stattype']])) {
$stat_type = $vars['stattype'];
}
$current_time = lowest_time(time() - 300);
$last_time = lowest_time($current_time - $lastN - 300);
$command = \LibreNMS\Config::get('nfdump') . ' -M ' . nfsen_live_dir($device['hostname']) . ' -T -R ' .
time_to_nfsen_subpath($last_time) . ':' . time_to_nfsen_subpath($current_time) .
' -n ' . $topN . ' -s ' . $stat_type . '/' . $stat_order;
echo '