Alert improvements

- check areAlertsEnabled() result is now cached
- housekeeping.lua skips alerts when disabled
This commit is contained in:
Luca Deri 2020-07-23 17:52:30 +02:00
parent 7ffb4df9a6
commit ab6455329a
3 changed files with 31 additions and 13 deletions

View file

@ -564,14 +564,26 @@ function noHtml(s)
return unescape(cleaned)
end
-- ##############################################
function areAlertsEnabled()
return (ntop.getPref("ntopng.prefs.disable_alerts_generation") ~= "1")
if(__alert_enabled == nil) then
-- Not too nice as changes will be read periodically as new VMs are reloaded
-- but at least we avoid breaking up the performance
__alert_enabled = (ntop.getPref("ntopng.prefs.disable_alerts_generation") ~= "1")
end
return (__alert_enabled)
end
-- ##############################################
function isScoreEnabled()
return(ntop.isEnterpriseM())
end
-- ##############################################
function hasTrafficReport()
local ts_utils = require("ts_utils_core")
local is_pcap_dump = interface.isPcapDumpInterface()