mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-02 08:50:12 +00:00
Renames alert_config to user_script_config
This commit is contained in:
parent
61ab06fcd7
commit
3144bc8bdf
12 changed files with 16 additions and 16 deletions
|
|
@ -105,7 +105,7 @@ function script.hooks.min(info)
|
|||
local bytes = host.getBytes()
|
||||
local tot_bytes = bytes["bytes.sent"] + bytes["bytes.rcvd"]
|
||||
|
||||
if(tot_bytes > info.alert_config.max_bytes) then
|
||||
if(tot_bytes > info.user_script_config.max_bytes) then
|
||||
-- Trigger alert
|
||||
alerts_api.trigger(info.alert_entity, alert_info)
|
||||
else
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ function script.hooks.min(info)
|
|||
-- Calculate the delta bytes wrt the previous hook run
|
||||
bytes_delta = alerts_api.interface_delta_val(script.key, info.granularity, info.entity_info["ndpi"]["HTTP"]["bytes.sent"])
|
||||
|
||||
if(bytes_delta > info.alert_config.max_sent_http_bytes) then
|
||||
if(bytes_delta > info.user_script_config.max_sent_http_bytes) then
|
||||
exceeded = true
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ function script.hooks.min(info)
|
|||
},
|
||||
}
|
||||
|
||||
if(inner_bytes > info.alert_config.max_inner_bytes) then
|
||||
if(inner_bytes > info.user_script_config.max_inner_bytes) then
|
||||
-- Trigger alert
|
||||
alerts_api.trigger(info.alert_entity, alert_info)
|
||||
else
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ function script.hooks.min(info)
|
|||
--tprint(info)
|
||||
print("system:min hook called")
|
||||
|
||||
ntop.pingHost(info.alert_config.ip_address, info.alert_config.v6)
|
||||
ntop.pingHost(info.user_script_config.ip_address, info.user_script_config.v6)
|
||||
|
||||
-- Wait results
|
||||
ntop.msleep(2000)
|
||||
|
|
@ -94,7 +94,7 @@ function script.hooks.min(info)
|
|||
-- The alert entity must be built manually for system scripts
|
||||
local alert_entity = {
|
||||
alert_entity = alert_consts.alert_entities.pinged_host,
|
||||
alert_entity_val = info.alert_config.ip_address,
|
||||
alert_entity_val = info.user_script_config.ip_address,
|
||||
}
|
||||
|
||||
local alert_info = {
|
||||
|
|
@ -104,13 +104,13 @@ function script.hooks.min(info)
|
|||
alert_type_params = {},
|
||||
}
|
||||
|
||||
if(res[info.alert_config.ip_address] ~= nil) then
|
||||
print(string.format("Host %s is active", info.alert_config.ip_address))
|
||||
if(res[info.user_script_config.ip_address] ~= nil) then
|
||||
print(string.format("Host %s is active", info.user_script_config.ip_address))
|
||||
|
||||
-- Release previously triggered alert (if any)
|
||||
alerts_api.release(alert_entity, alert_info)
|
||||
else
|
||||
print(string.format("Host %s is down", info.alert_config.ip_address))
|
||||
print(string.format("Host %s is down", info.user_script_config.ip_address))
|
||||
|
||||
-- Trigger alert
|
||||
alerts_api.trigger(alert_entity, alert_info)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue