mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Add isVSConfiguredHost and triggertHostNotConfiguredAlert. (#8051)
This commit is contained in:
parent
b1ae8ed1af
commit
a5a2146cfb
2 changed files with 44 additions and 4 deletions
|
|
@ -1058,8 +1058,19 @@ local function trigger_alert_host_down(host,host_name, epoch)
|
|||
ntop.rpushCache(scanned_hosts_changes_queue_key, json.encode(host_info_to_cache))
|
||||
|
||||
end
|
||||
-- **********************************************************
|
||||
|
||||
-- **********************************************************
|
||||
-- Function to trigger alert when an host is not configured
|
||||
local function trigger_alert_host_not_configured(host)
|
||||
local host_info_to_cache = {
|
||||
host = host,
|
||||
is_host_not_configured = true,
|
||||
}
|
||||
ntop.rpushCache(scanned_hosts_changes_queue_key, json.encode(host_info_to_cache))
|
||||
|
||||
end
|
||||
|
||||
-- **********************************************************
|
||||
-- Function to update host scan values
|
||||
function vs_utils.save_host_to_scan(scan_type, host, scan_result, last_scan_time, last_duration,
|
||||
is_ok_last_scan, ports, scan_frequency, num_open_ports,
|
||||
|
|
@ -1765,7 +1776,8 @@ local function retrieve_host_by_hash_key(host_hash_key)
|
|||
end
|
||||
-- **********************************************************
|
||||
|
||||
-- Function to retrieve a specific host scan info
|
||||
-- Function to retrieve a specific host scan info with scan type CVE
|
||||
-- (for host_details page )
|
||||
function vs_utils.retrieve_host(host)
|
||||
local hosts_scanned = ntop.getHashKeysCache(host_to_scan_key) or {}
|
||||
for key, _ in pairs(hosts_scanned) do
|
||||
|
|
@ -2551,9 +2563,30 @@ else
|
|||
end
|
||||
|
||||
-- **********************************************************
|
||||
function vs_utils.isVSConfiguredHost(ip)
|
||||
-- Function to find if an ip is configured
|
||||
|
||||
function vs_utils.isVSConfiguredHost(ip)
|
||||
local hosts_scanned = ntop.getHashKeysCache(prefs_host_values_key) or {}
|
||||
for key, _ in pairs(hosts_scanned) do
|
||||
if key:find(ip) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- **********************************************************
|
||||
-- Function to trigger an alert if the host
|
||||
-- is not configured
|
||||
|
||||
function vs_utils.triggerHostNotConfiguredAlert(host)
|
||||
trigger_alert_host_not_configured(host)
|
||||
end
|
||||
|
||||
-- **********************************************************
|
||||
|
||||
-- ##########################################################
|
||||
-- VS DB Functions
|
||||
-- **********************************************************
|
||||
|
||||
function vs_utils.retrieve_report_list(epoch)
|
||||
|
|
@ -2579,4 +2612,5 @@ function vs_utils.edit_report(epoch, report_name)
|
|||
return(vs_db_utils.edit_report(epoch,report_name))
|
||||
end
|
||||
|
||||
-- ##########################################################
|
||||
return vs_utils
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue