--
-- (C) 2013-15 - ntop.org
--
if(ntop.isPro()) then
print(ntop.httpRedirect(ntop.getHttpPrefix().."/lua/pro/dashboard.lua"))
return
end
dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
-- io.write ("Session:".._SESSION["session"].."\n")
require "lua_utils"
sendHTTPHeader('text/html; charset=iso-8859-1')
ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/header.inc")
-- NOTE: in the home page, footer.lua checks the ntopng version
-- so in case we change it, footer.lua must also be updated
active_page = "home"
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
interface.select(ifname)
ifstats = aggregateInterfaceStats(interface.getStats())
is_loopback = isLoopback(ifname)
iface_id = interface.name2id(ifname)
-- Load from or set in redis the refresh frequency for the top flow sankey
refresh = _GET["refresh"]
refresh_key = 'ntopng.prefs.'.._SESSION["user"]..'.'..ifname..'.top_flow_refresh'
if (refresh ~= nil) then
ntop.setCache(refresh_key,refresh)
else
refresh = ntop.getCache(refresh_key)
end
-- Default frequency (ms)
if (refresh == '') then refresh = 5000 end
--
page = _GET["page"]
if(page == nil) then
if(not(is_loopback)) then
page = "TopFlowTalkers"
else
page = "TopHosts"
end
end
if((ifstats ~= nil) and (ifstats.packets > 0)) then
-- Print tabbed header
print('\n')
if(page == "TopFlowTalkers") then
print('