mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
fix system view and add rtt host from host_details
This commit is contained in:
parent
be0c0a9566
commit
7479582210
113 changed files with 324 additions and 158 deletions
|
|
@ -52,7 +52,7 @@ for key, value in ipairs(flows_stats) do
|
|||
if(hitters[peer] == nil) then
|
||||
hitters[peer] = interface.getPeerHitRate(flows_stats[key]["cli.key"], host)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -63,11 +63,11 @@ rcvd_from_hitters = {}
|
|||
extra = 0.01 -- Used to avoid overwriting values with the same number of bytes
|
||||
for k,v in pairs(hitters) do
|
||||
if(v["sent"] > 0) then
|
||||
sent_to_hitters[v["sent"]+extra] = k
|
||||
sent_to_hitters[v["sent"]+extra] = k
|
||||
end
|
||||
|
||||
if(v["rcvd"] > 0) then
|
||||
rcvd_from_hitters[v["rcvd"]+extra] = k
|
||||
rcvd_from_hitters[v["rcvd"]+extra] = k
|
||||
end
|
||||
|
||||
extra = extra + 0.01
|
||||
|
|
@ -76,10 +76,10 @@ end
|
|||
print(' "top_destinations": [ ')
|
||||
|
||||
local num = 0
|
||||
for _value,_key in pairsByKeys(sent_to_hitters, rev) do
|
||||
for _value,_key in pairsByKeys(sent_to_hitters, rev) do
|
||||
peer_name = getResolvedAddress(hostkey2hostinfo(_key))
|
||||
h="<A HREF='"..ntop.getHttpPrefix().."/lua/host_details.lua?host=" .. _key.. "'>".. shortenString(peer_name).."</A>"
|
||||
|
||||
|
||||
if(num > 0) then print(",") end
|
||||
print(' { "ip": "'.._key..'", "host": "'..h..'", "bytes": '..round(_value, 0)..' }')
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ num = 0
|
|||
for _value,_key in pairsByKeys(rcvd_from_hitters, rev) do
|
||||
peer_name = getResolvedAddress(hostkey2hostinfo(_key))
|
||||
h="<A HREF='"..ntop.getHttpPrefix().."/lua/host_details.lua?host=" .. _key.. "'>".. shortenString(peer_name).."</A>"
|
||||
|
||||
|
||||
if(num > 0) then print(",") end
|
||||
print(' { "ip": "'.._key..'", "host": "'..h..'", "bytes": '..round(_value, 0)..' }')
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ local name_map = {
|
|||
{ "Unspecified", "Other Traffic" }
|
||||
}
|
||||
|
||||
function mapRRDname(name)
|
||||
function mapRRDname(name)
|
||||
for id,_ in ipairs(name_map) do
|
||||
local m = name_map[id]
|
||||
if(name == m[1]) then
|
||||
|
|
@ -80,7 +80,7 @@ if (_GET["host"] ~= nil and _GET["ifid"] ~= nil and _GET["step"] ~= nil) then
|
|||
else
|
||||
-- mode=get
|
||||
rrd = activbase.."/"..actname..".rrd"
|
||||
|
||||
|
||||
if(ntop.notEmptyFile(rrd)) then
|
||||
fetchData = true
|
||||
end
|
||||
|
|
@ -110,7 +110,7 @@ if (_GET["host"] ~= nil and _GET["ifid"] ~= nil and _GET["step"] ~= nil) then
|
|||
local cf = _GET["cf"] or "AVERAGE"
|
||||
local fstart, fstep, fnames, fdata = ntop.rrd_fetch(rrd, cf, start_time, end_time)
|
||||
res.step = fstep
|
||||
|
||||
|
||||
function getValue(w) if w ~= w then return 0 else return math.max(tonumber(w), 0) end end
|
||||
|
||||
for i, v in ipairs(fdata) do
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ require "flow_utils"
|
|||
local page_utils = require("page_utils")
|
||||
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
page_utils.manage_system_interface()
|
||||
|
||||
page_utils.print_header()
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ num = 0
|
|||
|
||||
for _key, value in ipairs(flows_stats) do
|
||||
p = flows_stats[_key]
|
||||
process = 1
|
||||
process = 1
|
||||
client_process = 1
|
||||
server_process = 1
|
||||
|
||||
|
|
@ -83,55 +83,55 @@ for _key, value in ipairs(flows_stats) do
|
|||
---------------- PID ----------------
|
||||
if(pid ~= nil) then
|
||||
if (debug) then traceError(TRACE_DEBUG,TRACE_CONSOLE,"Pid:"..pid.."\n")end
|
||||
if (p["client_process"] ~= nil) then
|
||||
if (p["client_process"] ~= nil) then
|
||||
if (debug) then traceError(TRACE_DEBUG,TRACE_CONSOLE,"Client pid:"..p["client_process"]["pid"].."\n") end
|
||||
if ((p["client_process"]["pid"] ~= pid)) then
|
||||
if ((p["client_process"]["pid"] ~= pid)) then
|
||||
process = 0
|
||||
end
|
||||
if (debug) then traceError(TRACE_DEBUG,TRACE_CONSOLE,"ClientProcess -\t"..process.."\n")end
|
||||
end
|
||||
if (p["server_process"] ~= nil) then
|
||||
if (p["server_process"] ~= nil) then
|
||||
if (debug) then traceError(TRACE_DEBUG,TRACE_CONSOLE,"Server pid:"..p["server_process"]["pid"].."\n") end
|
||||
if ((p["server_process"]["pid"] ~= pid)) then
|
||||
if ((p["server_process"]["pid"] ~= pid)) then
|
||||
process = 0
|
||||
end
|
||||
if (debug) then traceError(TRACE_DEBUG,TRACE_CONSOLE,"ServerProcess -\t"..process.."\n")end
|
||||
end
|
||||
if (debug) then traceError(TRACE_DEBUG,TRACE_CONSOLE,"Pid -\t"..process.."\n")end
|
||||
end
|
||||
|
||||
|
||||
---------------- NAME ----------------
|
||||
if(name ~= nil) then
|
||||
|
||||
|
||||
if (debug) then traceError(TRACE_DEBUG,TRACE_CONSOLE,"url:"..process_sourceId.."vlan:"..p["vlan"].."\n") end
|
||||
if (process_sourceId == p["vlan"]) then
|
||||
|
||||
if (debug) then traceError(TRACE_DEBUG,TRACE_CONSOLE,"Name:"..name.."\n")end
|
||||
if (p["client_process"] ~= nil) then
|
||||
if (p["client_process"] ~= nil) then
|
||||
if (debug) then traceError(TRACE_DEBUG,TRACE_CONSOLE,"Client name:"..p["client_process"]["name"].."\n") end
|
||||
|
||||
if ((p["client_process"]["name"] ~= name)) then
|
||||
if ((p["client_process"]["name"] ~= name)) then
|
||||
client_process = 0
|
||||
end
|
||||
if (debug) then traceError(TRACE_DEBUG,TRACE_CONSOLE,"ClientProcess -\t"..client_process.."\n")end
|
||||
|
||||
|
||||
end
|
||||
if (p["server_process"] ~= nil) then
|
||||
if (p["server_process"] ~= nil) then
|
||||
if (debug) then traceError(TRACE_DEBUG,TRACE_CONSOLE,"Server name:"..p["server_process"]["name"].."\n") end
|
||||
|
||||
if ((p["server_process"]["name"] ~= name)) then
|
||||
if ((p["server_process"]["name"] ~= name)) then
|
||||
server_process = 0
|
||||
end
|
||||
if (debug) then traceError(TRACE_DEBUG,TRACE_CONSOLE,"ServerProcess -\t"..server_process.."\n")end
|
||||
|
||||
|
||||
end
|
||||
if (debug) then traceError(TRACE_DEBUG,TRACE_CONSOLE,"name -\t"..process.."\n")end
|
||||
else
|
||||
client_process = 0
|
||||
client_process = 0
|
||||
server_process = 0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
---------------- HOST ----------------
|
||||
if((host ~= nil) and (p["cli.ip"] ~= host) and (p["srv.ip"] ~= host)) then
|
||||
|
|
@ -142,7 +142,7 @@ for _key, value in ipairs(flows_stats) do
|
|||
|
||||
if (process == 1) then
|
||||
|
||||
if((p["client_process"] ~= nil) and (client_process == 1) )then
|
||||
if((p["client_process"] ~= nil) and (client_process == 1) )then
|
||||
k = p["client_process"]
|
||||
key = k["name"] -- .."@"..p["vlan"]
|
||||
|
||||
|
|
@ -172,7 +172,7 @@ for _key, value in ipairs(flows_stats) do
|
|||
end
|
||||
end
|
||||
|
||||
if((p["server_process"] ~= nil) and (server_process == 1) )then
|
||||
if((p["server_process"] ~= nil) and (server_process == 1) )then
|
||||
k = p["server_process"]
|
||||
key = k["name"] -- .."@"..p["vlan"]
|
||||
|
||||
|
|
@ -229,13 +229,13 @@ for key, value in pairs(processes) do
|
|||
elseif(sortColumn == "column_bytes_sent") then
|
||||
vkey = processes[key]["bytes_sent"]+postfix
|
||||
elseif(sortColumn == "column_duration") then
|
||||
vkey = processes[key]["duration"]+postfix
|
||||
vkey = processes[key]["duration"]+postfix
|
||||
elseif(sortColumn == "column_count") then
|
||||
vkey = processes[key]["count"]+postfix
|
||||
vkey = processes[key]["count"]+postfix
|
||||
else
|
||||
vkey = key
|
||||
end
|
||||
|
||||
|
||||
vals[vkey] = key
|
||||
end
|
||||
|
||||
|
|
@ -253,7 +253,7 @@ end
|
|||
|
||||
if (mode == "table") then
|
||||
for _key, _value in pairsByKeys(vals, funct) do
|
||||
key = vals[_key]
|
||||
key = vals[_key]
|
||||
value = processes[key]
|
||||
|
||||
if(to_skip > 0) then
|
||||
|
|
@ -301,7 +301,7 @@ elseif (mode == "timeline") then
|
|||
|
||||
print ("[\n")
|
||||
for _key, _value in pairsByKeys(vals, funct) do
|
||||
key = vals[_key]
|
||||
key = vals[_key]
|
||||
value = processes[key]
|
||||
|
||||
if (num > 0) then print(',\n') end
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ require "flow_utils"
|
|||
local page_utils = require("page_utils")
|
||||
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
page_utils.manage_system_interface()
|
||||
|
||||
page_utils.print_header()
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ require "historical_utils"
|
|||
|
||||
local json = require ("dkjson")
|
||||
local host_pools_utils = require "host_pools_utils"
|
||||
local page_utils = require("page_utils")
|
||||
|
||||
|
||||
debug_hosts = false
|
||||
page = _GET["page"]
|
||||
|
|
@ -50,6 +52,7 @@ local labelKey = host_info["host"].."@"..host_info["vlan"]
|
|||
|
||||
if((host_name == nil) or (host_ip == nil)) then
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
page_utils.manage_system_interface()
|
||||
ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/header.inc")
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
|
||||
print("<div class=\"alert alert alert-danger\"><img src=".. ntop.getHttpPrefix() .. "/img/warning.png> Host parameter is missing (internal error ?)</div>")
|
||||
|
|
@ -103,6 +106,7 @@ if(host == nil) then
|
|||
page = "historical"
|
||||
only_historical = true
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
page_utils.manage_system_interface()
|
||||
ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/header.inc")
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
|
||||
print [[
|
||||
|
|
@ -123,6 +127,7 @@ if(host == nil) then
|
|||
-- We need to check if this is an aggregated host
|
||||
if(not(restoreFailed) and (host_info ~= nil) and (host_info["host"] ~= nil)) then json = ntop.getCache(host_info["host"].. "." .. ifId .. ".json") end
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
page_utils.manage_system_interface()
|
||||
ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/header.inc")
|
||||
if page == "alerts" then
|
||||
print('<script>window.location.href = "')
|
||||
|
|
@ -150,6 +155,7 @@ if(host == nil) then
|
|||
end
|
||||
else
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
page_utils.manage_system_interface()
|
||||
ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/header.inc")
|
||||
print("<link href=\""..ntop.getHttpPrefix().."/css/tablesorted.css\" rel=\"stylesheet\">\n")
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ show_aggregation = true
|
|||
|
||||
active_page = "hosts"
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
page_utils.manage_system_interface()
|
||||
|
||||
page_utils.print_header()
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,12 @@ dirs = ntop.getDirs()
|
|||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
require "lua_utils"
|
||||
local page_utils = require("page_utils")
|
||||
|
||||
|
||||
if(mode ~= "embed") then
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
page_utils.manage_system_interface()
|
||||
ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/header.inc")
|
||||
active_page = "hosts"
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
|
||||
|
|
@ -25,7 +28,7 @@ print (ntop.getHttpPrefix())
|
|||
print [[/lua/sprobe_hosts_data.lua", function(error, json) {
|
||||
if (error) return console.warn(error);
|
||||
links = json;
|
||||
|
||||
|
||||
// Compute the distinct nodes from the links.
|
||||
links.forEach(function(link) {
|
||||
s = link.source.split("@");
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ local page_utils = require("page_utils")
|
|||
|
||||
if(mode ~= "embed") then
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
page_utils.manage_system_interface()
|
||||
page_utils.print_header()
|
||||
active_page = "hosts"
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ require "lua_utils"
|
|||
local page_utils = require("page_utils")
|
||||
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
page_utils.manage_system_interface()
|
||||
|
||||
page_utils.print_header()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue