* * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ $minutes = 15; $seconds = ($minutes * 60); $top = $config['front_page_settings']['top']['devices']; if (is_admin() === true || is_read() === true) { $query = " SELECT *, sum(p.ifInOctets_rate + p.ifOutOctets_rate) as total FROM ports as p, devices as d WHERE d.device_id = p.device_id AND unix_timestamp() - p.poll_time < $seconds AND ( p.ifInOctets_rate > 0 OR p.ifOutOctets_rate > 0 ) GROUP BY d.device_id ORDER BY total desc LIMIT $top "; } else { $query = " SELECT *, sum(p.ifInOctets_rate + p.ifOutOctets_rate) as total FROM ports as p, devices as d, `devices_perms` AS `P` WHERE `P`.`user_id` = ? AND `P`.`device_id` = `d`.`device_id` AND d.device_id = p.device_id AND unix_timestamp() - p.poll_time < $seconds AND ( p.ifInOctets_rate > 0 OR p.ifOutOctets_rate > 0 ) GROUP BY d.device_id ORDER BY total desc LIMIT $top "; $param[] = array($_SESSION['user_id']); }//end if echo "Top $top devices (last $minutes minutes)\n"; echo "\n"; foreach (dbFetchRows($query, $param) as $result) { echo ''.''.''."\n"; } echo "
'.generate_device_link($result, shorthost($result['hostname'])).''.generate_device_link( $result, generate_minigraph_image($result, $config['time']['day'], $config['time']['now'], 'device_bits', 'no', 150, 21, '&', 'top10'), array(), 0, 0, 0 ).'
\n";