mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
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
38 lines
1.7 KiB
Lua
38 lines
1.7 KiB
Lua
--
|
|
-- (C) 2013-20 - ntop.org
|
|
--
|
|
|
|
local dirs = ntop.getDirs()
|
|
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
|
|
|
require "lua_utils"
|
|
local alert_utils = require "alert_utils"
|
|
|
|
local page_utils = require("page_utils")
|
|
local alerts_api = require("alerts_api")
|
|
|
|
sendHTTPContentTypeHeader('text/html')
|
|
|
|
|
|
page_utils.set_active_menu_entry(page_utils.menu_entries.detected_alerts)
|
|
|
|
alert_utils.checkDeleteStoredAlerts()
|
|
|
|
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
|
|
page_utils.print_page_title(i18n('alerts_dashboard.alerts'))
|
|
|
|
local has_engaged_alerts = alert_utils.hasAlerts("engaged", alert_utils.getTabParameters(_GET, "engaged"))
|
|
local has_past_alerts = alert_utils.hasAlerts("historical", alert_utils.getTabParameters(_GET, "historical"))
|
|
local has_flow_alerts = alert_utils.hasAlerts("historical-flows", alert_utils.getTabParameters(_GET, "historical-flows"))
|
|
local has_disabled_alerts = alerts_api.hasEntitiesWithAlertsDisabled(interface.getId())
|
|
|
|
if ntop.getPrefs().are_alerts_enabled == false then
|
|
print("<div class=\"alert alert alert-warning\"><img src=".. ntop.getHttpPrefix() .. "/img/warning.png>" .. " " .. i18n("show_alerts.alerts_are_disabled_message") .. "</div>")
|
|
--return
|
|
elseif not has_engaged_alerts and not has_past_alerts and not has_flow_alerts and not has_disabled_alerts then
|
|
print("<div class=\"alert alert alert-info\"><i class=\"fas fa-info-circle fa-lg\" aria-hidden=\"true\"></i>" .. " " .. i18n("show_alerts.no_recorded_alerts_message",{ifname=ifname}).."</div>")
|
|
else
|
|
alert_utils.drawAlertTables(has_past_alerts, has_engaged_alerts, has_flow_alerts, has_disabled_alerts, _GET)
|
|
end -- closes if ntop.getPrefs().are_alerts_enabled == false then
|
|
|
|
dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")
|