--
-- (C) 2013-18 - ntop.org
--
dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
require "graph_utils"
local ts_utils = require("ts_utils")
local page_utils = require("page_utils")
local storage_utils = require("storage_utils")
sendHTTPContentTypeHeader('text/html')
page_utils.print_header(i18n("about.runtime_status"))
active_page = "about"
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
local info = ntop.getInfo()
print("
\n")
local system_rowspan = 1
local system_host_stats = ntop.systemHostStat()
if system_host_stats["cpu_load"] ~= nil then system_rowspan = system_rowspan + 1 end
if system_host_stats["mem_total"] ~= nil then system_rowspan = system_rowspan + 1 end
if(info["pro.systemid"] and (info["pro.systemid"] ~= "")) then
print("| "..i18n("about.system").." | "..i18n("about.system_id").." | ".. info["pro.systemid"].." |
\n")
end
if system_host_stats["cpu_load"] ~= nil then
print("| "..i18n("about.cpu_load").." | ... |
\n")
end
if system_host_stats["mem_total"] ~= nil then
print("| "..i18n("about.ram_memory").." | |
\n")
end
local vers = string.split(info["version.git"], ":")
local ntopng_git_url = info["version"]
if((vers ~= nil) and (vers[2] ~= nil)) then
ntopng_git_url = ""..info["version"]..""
end
print("| "..info["product"].." | "..i18n("about.version").." | "..ntopng_git_url.." - ")
printntopngRelease(info)
print(" |
|---|
| "..i18n("about.platform").." | "..info["platform"].." - "..info["bits"] .." bit |
\n")
if(info.pid ~= nil) then
print("| PID (Process ID) | "..info.pid.." |
\n")
end
local storage_info = storage_utils.storageInfo()
local storage_items = {}
local classes = { "primary", "info", "warning", "success", "default" }
local colors = { "blue", "salmon", "seagreen", "cyan", "green", "magenta", "orange", "red", "violet" }
local col = 1
local num_items = 0
for if_id, if_info in pairs(storage_info.interfaces) do
local item = {
title = getInterfaceName(if_id),
value = if_info.total,
link = ntop.getHttpPrefix() .. "/lua/if_stats.lua?ifid=" .. if_id
}
if num_items < #classes then
item.class = classes[num_items+1]
else
item.style = "background-image: linear-gradient(to bottom, "..colors[col].." 0%, dark"..colors[col].." 100%)"
col = col + 1
if col > #colors then col = 1 end
end
table.insert(storage_items, item)
num_items = num_items + 1
end
if not ntop.isWindows() then
print("| "..i18n("traffic_recording.storage_utilization").." | ")
print(stackedProgressBars(storage_info.total, storage_items, nil, bytesToSize))
print(" |
\n")
end
if ts_utils.getDriverName() == "influxdb" then
print("| ".. i18n("prefs.influxdb_storage_title") .." |  .. ) |
\n")
print[[
]]
end
print("| "..i18n("about.startup_line").." | ".. info["product"] .." "..info["command_line"].." |
\n")
print("| "..i18n("about.last_log").." | \n")
for i=1,32 do
msg = ntop.listIndexCache("ntopng.trace", i)
if(msg ~= nil) then
print(msg.." \n")
end
end
print(" |
\n")
print("
\n")
dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")