Supports flow_db_utils to handle both nIndex and Clickhouse

This commit is contained in:
Simone Mainardi 2021-10-21 16:38:39 +02:00
parent d141115b96
commit 13701fdc2c
4 changed files with 9 additions and 9 deletions

View file

@ -20,7 +20,7 @@ local page_utils = require("page_utils")
local ts_utils = require("ts_utils")
local influxdb = require("influxdb")
local plugins_utils = require("plugins_utils")
local nindex_utils = nil
local flow_db_utils = nil
local info = ntop.getInfo()
local auth = require "auth"
@ -30,7 +30,7 @@ if(ntop.isPro()) then
package.path = dirs.installdir .. "/scripts/lua/pro/?.lua;" .. package.path
package.path = dirs.installdir .. "/scripts/lua/pro/modules/?.lua;" .. package.path
if hasNindexSupport() then
nindex_utils = require("nindex_utils")
flow_db_utils = require("flow_db_utils")
end
end

View file

@ -12,14 +12,14 @@ local hasRadius = ntop.hasRadiusSupport()
local hasNindex = hasNindexSupport()
local hasLdap = ntop.hasLdapSupport()
local max_nindex_retention = 0
local nindex_utils = nil
local flow_db_utils = nil
if ntop.isPro() then
package.path = dirs.installdir .. "/scripts/lua/pro/modules/?.lua;" .. package.path
if hasNindexSupport() then
nindex_utils = require("nindex_utils")
_, max_nindex_retention = nindex_utils.getRetention()
flow_db_utils = require("flow_db_utils")
_, max_nindex_retention = flow_db_utils.getRetention()
end
end

View file

@ -36,8 +36,8 @@ function storage_utils.interfaceStorageInfo(ifid, separate_pcap_volume, refresh_
-- end
if interfaceHasNindexSupport() then
local nindex_utils = require "nindex_utils"
local flows_storage_info = nindex_utils.storageInfo(ifid, timeout)
local flow_db_utils = require "flow_db_utils"
local flows_storage_info = flow_db_utils.storageInfo(ifid, timeout)
info["flows"] = flows_storage_info.total
info["total"] = info["total"] + flows_storage_info.total
end

View file

@ -14,8 +14,8 @@ sendHTTPContentTypeHeader('text/html')
page_utils.print_header(i18n("about.about_x", { product=info.product }))
if ntop.isEnterpriseM() and hasNindexSupport() then
local nindex_utils = require "nindex_utils"
nindex_utils.deleteOldFLows(true --[[ verbose ]])
local flow_db_utils = require "flow_db_utils"
flow_db_utils.deleteOldFLows(true --[[ verbose ]])
else
print("nIndex delete unsupported")
end