ntopng/scripts/lua/get_host_traffic.lua
2015-04-30 12:22:35 +02:00

23 lines
No EOL
433 B
Lua

--
-- (C) 2014-15-15 - ntop.org
--
dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
sendHTTPHeader('text/html; charset=iso-8859-1')
host_ip = _GET["host"]
interface.select(ifname)
host = interface.getHostInfo(host_ip)
if(host == nil) then
value = 0
else
value = host["packets.sent"]+host["packets.rcvd"]
end
print(' { "value": ' .. value .. ' } ')