mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Rework formatAlertMessage json decoding
This commit is contained in:
parent
4c36e7bab4
commit
b6d10f2d2a
2 changed files with 17 additions and 5 deletions
|
|
@ -2018,14 +2018,25 @@ end
|
|||
|
||||
-- #################################
|
||||
|
||||
function alert_utils.formatAlertMessage(ifid, alert)
|
||||
local msg
|
||||
function alert_utils.getAlertInfo(alert)
|
||||
local alert_json = alert["alert_json"]
|
||||
|
||||
if isEmptyString(alert_json) then
|
||||
alert_json = {}
|
||||
elseif(string.sub(alert_json, 1, 1) == "{") then
|
||||
alert_json = json.decode(alert_json)
|
||||
alert_json = json.decode(alert_json) or {}
|
||||
end
|
||||
|
||||
return alert_json
|
||||
end
|
||||
|
||||
-- #################################
|
||||
|
||||
function alert_utils.formatAlertMessage(ifid, alert, alert_json)
|
||||
local msg
|
||||
|
||||
if(alert_json == nil) then
|
||||
alert_json = alert_utils.getAlertInfo(alert)
|
||||
end
|
||||
|
||||
if(alert.alert_entity == alert_consts.alertEntity("flow") or (alert.alert_entity == nil)) then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue