Implements checks for script type and alert severity in dispatch_notification

This commit is contained in:
Simone Mainardi 2020-09-16 13:08:07 +02:00
parent 8a31d3b11d
commit b7341506f7
5 changed files with 41 additions and 11 deletions

View file

@ -183,7 +183,7 @@ function alerts_api.store(entity_info, type_info, when)
interface.incTotalHostAlerts(entity_info.alert_entity_val, type_info.alert_type.alert_key)
end
recipients_instance:dispatch_notification(alert_to_store)
recipients_instance:dispatch_notification(alert_to_store, current_script)
return(true)
end
@ -320,7 +320,7 @@ function alerts_api.trigger(entity_info, type_info, when, cur_alerts)
-- same 100 alerts will be triggered again as soon as ntopng is restarted, causing
-- 100 trigger notifications to be emitted twice. This check is to prevent such behavior.
if not is_trigger_notified(triggered) then
recipients_instance:dispatch_notification(triggered)
recipients_instance:dispatch_notification(triggered, current_script)
mark_trigger_notified(triggered)
end
@ -390,7 +390,7 @@ function alerts_api.release(entity_info, type_info, when, cur_alerts)
addAlertPoolInfo(entity_info, released)
recipients_instance:dispatch_notification(released)
recipients_instance:dispatch_notification(released, current_script)
mark_release_notified(released)
return(true)