mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
Refactors alert_utils and enterprise_alert_utils
Addresses #3720 Alerts Refactor: alert_utils as module Alerts Refactor: notify_ntopng_start and notify_ntopng_stop Alerts Refactor: processAlertNotifications Alerts Refactor: checkStoreAlertsFromC Alerts Refactor: formatAlertNotification Alerts Refactor: notification_timestamp_rev Alerts Refactor: formatAlertMessage Alerts Refactor: getConfigsetAlertLink Alerts Refactor: alertNotificationActionToLabel Alerts Refactor: flushAlertsData Alerts Refactor: disableAlertsGeneration Alerts Refactor: newAlertsWorkingStatus and other Alerts Refactor: drawAlerts Alerts Refactor: drawAlertTables Alerts Refactor: printAlertTables Alerts Refactor: checkDeleteStoredAlerts Alerts Refactor: getUnpagedAlertOptions Alerts Refactor: getTabParameters Alerts Refactor: getAlerts Alerts Refactor: getNumAlerts Alerts Refactor: performAlertsQuery Alerts Refactor: sec2granularity Alerts Refactor: granularity2id Alerts Refactor: granularity2sec Alerts Refactor: alertEngineLabel Alerts Refactor: alertEngine Alerts Refactor: alertEngineRaw Alerts Refactor: alertTypeDescription Alerts Refactor: alertType Alerts Refactor: alertTypeLabel Alerts Refactor: alertTypeRaw Alerts Refactor: alertSeverity Alerts Refactor: alertSeverityLabel Alerts Refactor: alertSeverityRaw Alerts Refactor: get_make_room_keys Alerts Refactor: enterprise_alert_utils
This commit is contained in:
parent
c83d622ad4
commit
e487427aab
52 changed files with 354 additions and 353 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
require "lua_utils"
|
||||
local json = require "dkjson"
|
||||
local alert_utils = require "alert_utils"
|
||||
local alert_consts = require "alert_consts"
|
||||
|
||||
local syslog = {}
|
||||
|
|
@ -46,23 +47,23 @@ function syslog.dequeueAlerts(queue)
|
|||
|
||||
for _, by_severity in pairs(alerts_by_types) do
|
||||
for severity, notifications in pairs(by_severity) do
|
||||
severity = alertSeverityRaw(severity)
|
||||
severity = alert_consts.alertSeverityRaw(severity)
|
||||
|
||||
-- Most recent notifications first
|
||||
for _, notif in pairsByValues(notifications, notification_timestamp_rev) do
|
||||
for _, notif in pairsByValues(notifications, alert_utils.notification_timestamp_rev) do
|
||||
local syslog_severity = alert_consts.alertLevelToSyslogLevel(severity)
|
||||
|
||||
local msg
|
||||
|
||||
if syslog_format == "plaintext" then
|
||||
-- prepare a plaintext message
|
||||
msg = formatAlertNotification(notif, {nohtml = true,
|
||||
msg = alert_utils.formatAlertNotification(notif, {nohtml = true,
|
||||
show_severity = true,
|
||||
show_entity = true})
|
||||
else -- syslog_format == "json" then
|
||||
-- send out the json message but prepare a nice
|
||||
-- message
|
||||
notif.message = formatAlertNotification(notif, {nohtml = true,
|
||||
notif.message = alert_utils.formatAlertNotification(notif, {nohtml = true,
|
||||
show_severity = false,
|
||||
show_entity = false})
|
||||
msg = json.encode(notif)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue