--
-- (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)
is_historical = interface.isHistoricalInterface(interface.name2id(ifname))
ifstats = 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.stats_packets > 0)) then
-- Print tabbed header
print('\n')
if(page == "TopFlowTalkers") then
print('
]]
print [[
]]
else
ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/index_" .. page .. ".inc")
end
--ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/index_top.inc")
-- ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/index_bottom.inc")
else
if (interface.isHistoricalInterface(iface_id)) then
print [[
Welcome to the Historical Interface In order to use this interface you must specify, via the configuration page, the interface, for which you want to load the historical data, and the time interval to be loaded.
]]
else
print("
No packet has been received yet on interface " .. getHumanReadableInterfaceName(ifname) .. ".
Please wait seconds until this page reloads.
")
end
end
dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")