mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
parent
7c49514ba0
commit
bd27304c54
6 changed files with 266 additions and 23 deletions
|
|
@ -777,17 +777,19 @@ end
|
|||
-- ########################################################
|
||||
|
||||
function db_utils.harverstExpiredMySQLFlows(ifname, mysql_retention, verbose)
|
||||
interface.select(ifname)
|
||||
|
||||
local dbtables = {"flowsv4", "flowsv6"}
|
||||
if useAggregatedFlows() then
|
||||
dbtables[#dbtables+1] = "aggrflowsv4"
|
||||
dbtables[#dbtables+1] = "aggrflowsv6"
|
||||
end
|
||||
|
||||
if tonumber(ifname) == nil then
|
||||
ifname = getInterfaceId(ifname)
|
||||
end
|
||||
|
||||
for _, tb in pairs(dbtables) do
|
||||
local sql = "DELETE FROM "..tb.." where FIRST_SWITCHED < "..mysql_retention
|
||||
sql = sql.." AND (INTERFACE_ID = "..getInterfaceId(ifname)..")"
|
||||
sql = sql.." AND (INTERFACE_ID = "..ifname..")"
|
||||
sql = sql.." AND (NTOPNG_INSTANCE_NAME='"..ntop.getPrefs()["instance_name"].."' OR NTOPNG_INSTANCE_NAME IS NULL OR NTOPNG_INSTANCE_NAME='')"
|
||||
interface.execSQLQuery(sql)
|
||||
if(verbose) then io.write(sql.."\n") end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue