Historical flow enhancements for queries

This commit is contained in:
Luca Deri 2015-08-19 00:16:28 +02:00
parent 863da4eca1
commit ee65e5f143
2 changed files with 21 additions and 5 deletions

View file

@ -41,12 +41,28 @@ end
--- ====================================================================
function getInterfaceFlows(interface_id, version, host, vlan, begin_epoch, end_epoch, limit_low, limit_high)
end
function getFlowInfo(interface_id, version, flow_idx)
version = tonumber(version)
--- ====================================================================
if(version == 4) then
sql = "select INET_NTOA(IP_SRC_ADDR) AS IP_SRC_ADDR,INET_NTOA(IP_DST_ADDR) AS IP_DST_ADDR"
else
sql = "select IP_SRC_ADDR, IP_DST_ADDR"
end
function getHostTopFlows(interface_id, version, host, vlan, begin_epoch, end_epoch, max_num_flows)
follow = " ,L4_SRC_PORT,L4_DST_PORT,VLAN_ID,PROTOCOL,FIRST_SWITCHED,LAST_SWITCHED,PACKETS,BYTES,idx,L7_PROTO,CONVERT(UNCOMPRESS(JSON) USING 'utf8') AS JSON from flowsv"..version.."_"..interface_id.." where idx="..flow_idx
sql = sql .. follow
if(db_debug == true) then io.write(sql.."\n") end
res = interface.execSQLQuery(sql)
if(type(res) == "string") then
if(db_debug == true) then io.write(res.."\n") end
return nil
else
return(res)
end
end
--- ====================================================================