Migrate C flow status alerts to Lua user scripts

- Alerts and flow status cleanup
- Community flow user scripts migration
- Implement scripts filters by l7 proto and packet interface only
- Migrate flow2statusinfojson
- Lower flow periodic update to 30 seconds if there is flow activity
- Display flow scripts without a gui section
This commit is contained in:
emanuele-f 2019-10-17 17:37:15 +02:00
parent bfdf5773d3
commit b3a8c6d49a
37 changed files with 1071 additions and 1287 deletions

View file

@ -11,6 +11,7 @@ require "graph_utils"
local tcp_flow_state_utils = require("tcp_flow_state_utils")
local format_utils = require("format_utils")
local flow_consts = require "flow_consts"
local json = require("dkjson")
if ntop.isPro() then
package.path = dirs.installdir .. "/scripts/lua/pro/modules/?.lua;" .. package.path
@ -36,6 +37,24 @@ end
-- #######################
-- Extracts the information serialized into status_info from the flow
-- user scripts
function flow2statusinfo(flow)
local status_info = flow["status_info"]
if(status_info and (string.sub(status_info, 1, 1) == "{")) then
local res = json.decode(status_info)
if(res ~= nil) then
return(res)
end
end
return(status_info)
end
-- #######################
function getFlowsFilter()
-- Pagination
local sortColumn = _GET["sortColumn"]