Added possibility to send notification to recipients (#7781)

This commit is contained in:
Matteo Biscosi 2023-08-24 15:55:29 +00:00
parent 54fdef7f10
commit b691841321
15 changed files with 285 additions and 122 deletions

View file

@ -501,6 +501,12 @@ end
--
-- Returns a summary of the alert as readable text
function alert_utils.formatAlertNotification(notif, options)
-- In case just a msg is needed, return directly the msg, this is used for reports
if not notif.score and notif.msg then
return notif.msg
end
-- Otherwise format the alert
local defaults = {
nohtml = false,
show_severity = true
@ -924,6 +930,10 @@ function alert_utils.filter_notification(notification, recipient_id)
local entity_id = alert_info.entity_id
local entity_val = alert_info.entity_val
if notification.score == 0 then
return true
end
local alert_id = alert_consts.getAlertType(alert_key, entity_id)
return alert_utils.check_alert_policy(entity_id, entity_val, alert_id, alert_info, recipient_id)