--
-- (C) 2013-20 - ntop.org
--
require "os"
require "lua_utils"
local ts_utils = require("ts_utils_core")
local template = require "template_utils"
local page_utils = require "page_utils"
local have_nedge = ntop.isnEdge()
local info = ntop.getInfo(true)
local is_admin = isAdministrator()
interface.select(ifname)
local iface_id = interface.name2id(ifname)
local _ifstats = interface.getStats()
local ifid = _ifstats.id
if not interface.isPcapDumpInterface() and not have_nedge then
if(ifname ~= nil) then
maxSpeed = getInterfaceSpeed(_ifstats.id)
end
-- io.write(maxSpeed)
if((maxSpeed == "") or (maxSpeed == nil)) then
-- if the speed in not custom we try to read the speed from the interface
-- and, as a final resort, we use 1Gbps
if tonumber(_ifstats.speed) ~= nil then
maxSpeed = tonumber(_ifstats.speed) * 1e6
else
maxSpeed = 1000000000 -- 1 Gbit
end
else
-- use the user-specified custom value for the speed
maxSpeed = tonumber(maxSpeed)*1000000
end
end -- closes interface.isPcapDumpInterface() == false
if not info.oem then
print ([[
]]
else -- info.oem
print[[
| ]] print(i18n("about.uptime")) print[[:
]]
end
local traffic_peity_width = "64"
if ts_utils.getDriverName() == "influxdb" then
local msg = ntop.getCache("ntopng.cache.influxdb.last_error")
if not isEmptyString(msg) then
print([[
]])
end
end
-- Toogle System Interface
-- render switchable system view
print([[
]])
-- End of Toggle System Interface
-- Only show the message if the host protocol/category timeseries are enabled
local message_enabled = (areHostL7TimeseriesEnabled(ifid) or areHostCategoriesTimeseriesEnabled(ifid)) and
(ts_utils.getDriverName() ~= "influxdb") and
(ntop.getPref("ntopng.prefs.disable_ts_migration_message") ~= "1")
-- Import the BlogNotification Utils script only
-- if ntopng is not in OEM version
if not info.oem then
-- Create a CSRF Token to handle the blog notifications
print([[
]])
end
print [[
]])
-- ######################################
if have_nedge then
print[[
]]
print(
template.gen("modal_confirm_dialog.html", {
dialog={
id = "poweroff_dialog",
action = "$('#powerOffForm').submit()",
title = i18n("nedge.power_off"),
message = i18n("nedge.power_off_confirm"),
confirm = i18n("nedge.power_off"),
}
})
)
print(
template.gen("modal_confirm_dialog.html", {
dialog={
id = "reboot_dialog",
action = "$('#rebootForm').submit()",
title = i18n("nedge.reboot"),
message = i18n("nedge.reboot_corfirm"),
confirm = i18n("nedge.reboot"),
}
})
)
end
-- ######################################
-- close wrapper
print[[