Rework alertEntity functions to avoid modules circular dependencies

Fixes #2975
This commit is contained in:
emanuele-f 2019-10-23 13:01:57 +02:00
parent 19f820f1bc
commit 10aa5542f8
30 changed files with 112 additions and 86 deletions

View file

@ -4,14 +4,11 @@
local driver = {}
-- NOTE: this script is required by second.lua, keep the imports minimal!
local ts_common = require("ts_common")
local json = require("dkjson")
local os_utils = require("os_utils")
local alerts_api = require("alerts_api")
local data_retention_utils = require "data_retention_utils"
require("ntop_utils")
require "alert_utils"
--
-- Sample query:
@ -77,6 +74,7 @@ end
-- ##############################################
local function getDatabaseRetentionDays()
local data_retention_utils = require "data_retention_utils"
return data_retention_utils.getDataRetentionDays()
end
@ -886,6 +884,8 @@ function driver:_droppedExportablesAlert()
local k = "ntopng.cache.influxdb_dropped_points_alert_triggered"
if ntop.getCache(k) ~= "1" then
local alerts_api = require("alerts_api")
alerts_api.store(
alerts_api.influxdbEntity(self.url),
alerts_api.influxdbDroppedPointsType(self.url)