Rework scanAlerts to avoid iterating hosts twice

This commit is contained in:
emanuele-f 2017-11-23 14:50:09 +01:00
parent 0afb961ca2
commit 83a58ad016
3 changed files with 150 additions and 125 deletions

View file

@ -648,6 +648,11 @@ function areAlertsEnabled()
return (ntop.getPref("ntopng.prefs.disable_alerts_generation") ~= "1")
end
function mustScanAlerts(ifstats)
-- can't alert on view interfaces as checkpoints will collide for their underlying real interfaces
return areAlertsEnabled() and not ifstats["isView"]
end
function hasAlertsDisabled()
return ((_POST["disable_alerts_generation"] ~= nil) and (_POST["disable_alerts_generation"] == "1")) or
((_POST["disable_alerts_generation"] == nil) and (ntop.getPref("ntopng.prefs.disable_alerts_generation") == "1"))