mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
Implements download of user alerts
This commit is contained in:
parent
b6043c1e72
commit
9b3b0b93bf
4 changed files with 25 additions and 9 deletions
|
|
@ -751,7 +751,7 @@ local BASE_RNAME = {
|
|||
SEVERITY = { name = "severity", export = true},
|
||||
DURATION = { name = "duration", export = true},
|
||||
COUNT = { name = "count", export = true},
|
||||
SCRIPT_KEY = { name = "script_key", export = true},
|
||||
SCRIPT_KEY = { name = "script_key", export = false},
|
||||
}
|
||||
|
||||
--@brief Convert an alert coming from the DB (value) to a record returned by the REST API
|
||||
|
|
|
|||
|
|
@ -59,6 +59,17 @@ end
|
|||
|
||||
-- ##############################################
|
||||
|
||||
local RNAME = {
|
||||
ALERT_NAME = { name = "alert_name", export = true},
|
||||
MSG = { name = "msg", export = true, elements = {"name", "value", "description"}}
|
||||
}
|
||||
|
||||
function user_alert_store:get_rnames()
|
||||
return RNAME
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
--@brief Convert an alert coming from the DB (value) to a record returned by the REST API
|
||||
function user_alert_store:format_record(value, no_html)
|
||||
local record = self:format_json_record_common(value, alert_entities.user.entity_id, no_html)
|
||||
|
|
@ -67,13 +78,13 @@ function user_alert_store:format_record(value, no_html)
|
|||
local alert_name = alert_consts.alertTypeLabel(tonumber(value["alert_id"]), no_html, alert_entities.user.entity_id)
|
||||
local msg = alert_utils.formatAlertMessage(ifid, value, alert_info)
|
||||
|
||||
record["alert_name"] = alert_name
|
||||
record[RNAME.ALERT_NAME.name] = alert_name
|
||||
|
||||
if string.lower(noHtml(msg)) == string.lower(noHtml(alert_name)) then
|
||||
msg = ""
|
||||
end
|
||||
|
||||
record["msg"] = {
|
||||
record[RNAME.MSG.name] = {
|
||||
name = noHtml(alert_name),
|
||||
value = tonumber(value["alert_id"]),
|
||||
description = msg,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue