Add ability to manually release an alert

This commit is contained in:
emanuele-f 2019-09-04 12:27:58 +02:00
parent 463b5d8325
commit b62e4183f0
6 changed files with 89 additions and 9 deletions

View file

@ -312,6 +312,11 @@ function alerts_api.release(entity_info, type_info, when)
local params = {alert_key_name, granularity_id, when}
local released = nil
if(type_info.alert_severity == nil) then
alertErrorTraceback(string.format("Missing alert_severity [type=%s]", type_info.alert_type and type_info.alert_type.alert_id or ""))
return(false)
end
if(entity_info.alert_entity.entity_id == alertEntity("host")) then
host.checkContext(entity_info.alert_entity_val)
released = host.releaseTriggeredAlert(table.unpack(params))
@ -334,11 +339,6 @@ function alerts_api.release(entity_info, type_info, when)
entity_info.alert_entity_val .."@"..type_info.alert_type.i18n_title..":".. subtype .. "\n") end
end
if(type_info.alert_severity == nil) then
alertErrorTraceback(string.format("Missing alert_severity [type=%s]", type_info.alert_type and type_info.alert_type.alert_id or ""))
return(false)
end
enqueueStoreAlert(ifid, released)
pushAlertNotification(ifid, "release", released)
return(true)