mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-02 00:40:10 +00:00
parent
41ff6bcb3b
commit
f75331d2b5
10 changed files with 146 additions and 8 deletions
74
scripts/lua/os_details.lua
Normal file
74
scripts/lua/os_details.lua
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
--
|
||||
-- (C) 2013-21 - ntop.org
|
||||
--
|
||||
|
||||
dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
require "lua_utils"
|
||||
local graph_utils = require "graph_utils"
|
||||
|
||||
local page_utils = require("page_utils")
|
||||
|
||||
local OS = _GET["os"]
|
||||
local page = _GET["page"]
|
||||
|
||||
interface.select(ifname)
|
||||
local ifstats = interface.getStats()
|
||||
local ifId = ifstats.id
|
||||
local ts_utils = require("ts_utils")
|
||||
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
|
||||
|
||||
page_utils.set_active_menu_entry(page_utils.menu_entries.countries)
|
||||
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
|
||||
|
||||
if(OS == nil) then
|
||||
print("<div class=\"alert alert alert-danger\"><img src=".. ntop.getHttpPrefix() .. "/img/warning.png> ".. i18n("os_details.os_parameter_missing_message") .. "</div>")
|
||||
return
|
||||
end
|
||||
|
||||
if(not ts_utils.exists("os:traffic", {ifid=ifId, os=OS})) then
|
||||
print("<div class=\"alert alert alert-danger\"><img src=".. ntop.getHttpPrefix() .. "/img/warning.png> " .. i18n("os_details.no_available_stats_for_os",{os=OS}) .. "</div>")
|
||||
return
|
||||
end
|
||||
|
||||
--[[
|
||||
Create Menu Bar with buttons
|
||||
--]]
|
||||
local nav_url = ntop.getHttpPrefix().."/lua/os_details.lua?country="..OS
|
||||
local title = i18n("os_details.os") .. ": "..OS
|
||||
|
||||
page_utils.print_navbar(title, nav_url,
|
||||
{
|
||||
{
|
||||
active = page == "historical" or not page,
|
||||
page_name = "historical",
|
||||
label = "<i class='fas fa-lg fa-chart-area'></i>",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
--[[
|
||||
Selectively render information pages
|
||||
--]]
|
||||
if page == "historical" then
|
||||
local schema = _GET["ts_schema"] or "os:traffic"
|
||||
local selected_epoch = _GET["epoch"] or ""
|
||||
local url = ntop.getHttpPrefix()..'/lua/os_details.lua?ifid='..ifId..'&os='..OS..'&page=historical'
|
||||
|
||||
local tags = {
|
||||
ifid = ifId,
|
||||
os = OS,
|
||||
}
|
||||
|
||||
graph_utils.drawGraphs(ifId, schema, tags, _GET["zoom"], url, selected_epoch, {
|
||||
timeseries = {
|
||||
{schema="os:traffic", label=i18n("traffic"), split_directions = true},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")
|
||||
Loading…
Add table
Add a link
Reference in a new issue