-- -- (C) 2013-21 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path require "lua_utils" local page_utils = require("page_utils") local ui_utils = require("ui_utils") sendHTTPContentTypeHeader('text/html') page_utils.set_active_menu_entry(page_utils.menu_entries.top_hosts) dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua") interface.select(ifname) local interface_refresh_rate = getInterfaceRefreshRate(getInterfaceId(ifname)) or 3 local hosts_stats = interface.getLocalHostsInfo() local hosts_stats = hosts_stats["hosts"] --io.write(ifname.."/"..total.."\n") local max_num = 25 local localhosts = {} local found = false local num = 0 for key, value in pairs(hosts_stats) do --print(hosts_stats[key]["name"].."
\n") if((hosts_stats[key]["localhost"] == true) and (hosts_stats[key]["ip"] ~= nil)) then localhosts[key] = hosts_stats[key]["packets.sent"]+hosts_stats[key]["packets.rcvd"] found = true num = num + 1 end end if(found) then page_utils.print_page_title(i18n("top_hosts.top_hosts_local")) print [[