1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
--
-- (C) 2013-22 - ntop.org
--
local dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
package.path = dirs.installdir .. "/scripts/lua/modules/alert_store/?.lua;" .. package.path
require "lua_utils"
local page_utils = require("page_utils")
local ui_utils = require "ui_utils"
local json = require "dkjson"
local dscp_consts = require "dscp_consts"
local template_utils = require "template_utils"
local alert_entities = require "alert_entities"
local alert_consts = require "alert_consts"
local alert_utils = require "alert_utils"
local alert_store = require "alert_store"
local alert_store_utils = require "alert_store_utils"
local alert_store_instances = alert_store_utils.all_instances_factory()
sendHTTPContentTypeHeader('text/html')
page_utils.set_active_menu_entry(page_utils.menu_entries.detected_alerts)
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
-- ######################################
local ifid = interface.getId()
local page = _GET["page"]
local status = _GET["status"] or "historical"
local row_id = _GET["row_id"]
-- ######################################
local url = ntop.getHttpPrefix() .. "/lua/alert_stats.lua?"
local pages = {
{
active = true,
page_name = "overview",
label = i18n("overview"),
}
}
-- #######################################
local label = i18n("alerts_dashboard.alert")
local details = {}
local alert = nil
if page and row_id and alert_entities[page] then
local alert_store_instance = alert_store_instances[alert_entities[page].alert_store_name]
if alert_store_instance then
alerts, recordsFiltered = alert_store_instance:select_request(nil, "*")
if #alerts >= 1 then
alert = alerts[1]
-- formatted_alert = alert_store_instance:format_record(alert, false)
details = alert_store_instance:get_alert_details(alert)
label = label .. ": " .. alert_store_instance:get_alert_label(alert)
end
end
end
page_utils.print_navbar(label, url, pages)
-- #######################################
local context = {
ifid = ifid,
json = json,
alert = alert,
details = details,
}
template_utils.render("pages/alerts/alert_details.template", context)
dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")
|