mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Fix periodicity scan notify
This commit is contained in:
parent
f72d74194b
commit
04cddc6a4f
1 changed files with 14 additions and 10 deletions
|
|
@ -749,28 +749,32 @@ function vs_utils.schedule_periodic_scan(periodicity)
|
|||
if (#host_to_scan_list > 0 ) then
|
||||
local is_already_running = ntop.getCache(host_to_scan_periodicity_key) == "1"
|
||||
if not is_already_running then
|
||||
|
||||
|
||||
local is_scanning_almost_one = false
|
||||
|
||||
for _,scan_info in ipairs(host_to_scan_list) do
|
||||
local frequency = scan_info.scan_frequency
|
||||
|
||||
if(frequency == periodicity) then
|
||||
vs_utils.schedule_host_scan(scan_info.scan_type, scan_info.host, scan_info.ports, scan_info.id, true)
|
||||
is_scanning_almost_one = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
ntop.setCache(host_to_scan_periodicity_key , "1")
|
||||
ntop.setCache(host_to_scan_periodicity_key.."type", periodicity)
|
||||
if is_scanning_almost_one then
|
||||
ntop.setCache(host_to_scan_periodicity_key , "1")
|
||||
ntop.setCache(host_to_scan_periodicity_key.."type", periodicity)
|
||||
|
||||
local notification_message = ""
|
||||
if (periodicity == "1day") then
|
||||
notification_message = i18n("hosts_stats.page_scan_hosts.periodicity_scan_1_day_started")
|
||||
elseif (periodicity == "1week") then
|
||||
notification_message = i18n("hosts_stats.page_scan_hosts.periodicity_scan_1_week_started")
|
||||
local notification_message = ""
|
||||
if (periodicity == "1day") then
|
||||
notification_message = i18n("hosts_stats.page_scan_hosts.periodicity_scan_1_day_started")
|
||||
elseif (periodicity == "1week") then
|
||||
notification_message = i18n("hosts_stats.page_scan_hosts.periodicity_scan_1_week_started")
|
||||
end
|
||||
|
||||
recipients.sendMessageByNotificationType({periodicity = periodicity, success=true, message = notification_message}, "vulnerability_scans")
|
||||
end
|
||||
|
||||
recipients.sendMessageByNotificationType({periodicity = periodicity, success=true, message = notification_message}, "vulnerability_scans")
|
||||
end
|
||||
end
|
||||
return true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue