mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
* Integrate modified nvd3 library with zoom and multicharts working support * Fix count in RRD driver * Initial chart ajax migration * Update nvd3 with zoom stack support * Fix RRD listSeries with directories * Work in progress graphs * Compatibility fix * Initial support for schema based api * Add missing script * Fix listSeries for existance check * Implement topk timseries api * Implement topk queries and fix labels and formats * Migrate interface top sender and receivers * Migrate charts to new API * Move timeseries list for menu inside respective scripts * Add support for extended labels * Fix missing fields while chaning graph resolution Also Rename drawRRD in drawGraphs * Fix historical tabs * Add missing time fence in influx topk * Add graphs support for custom statistics visualization * Initial support for graphs statistics footer * Implement statistics in single graphs for RRD driver * Move sampling function into the driver and fix graph statistics * Fix max/min value offset * Implement influxdb sampling use built-in FILL * Implement stats and total serie in influxdb driver * Update nvd3 with multiChart fixes * Update nvd3 with new multiChart fixes * RRD driver fixes * Move metrics type from single metric to schema * Handle ajax errors and empty data in charts * Fix flow device interfaces graphs * Use timeserie label as timeseries dropdown text * Implement topk aggregation into one data serie * ts_utils module now provides all the schemas * Migrate ntop.exist(rrd) to ts_utils.exist * Fix timeseries dropdown label * L4 protos fixes for charts * Migrate getProtoVolume to new API * Integrate nvd3 fix for tooltip position * Initial community graphs migration to timseries API * Fix community timeseries dropdown and historical tabs * Hide total serie by default * Remove l4 protos from topk charts
82 lines
1.9 KiB
Lua
82 lines
1.9 KiB
Lua
--
|
|
-- (C) 2013-18 - ntop.org
|
|
--
|
|
|
|
dirs = ntop.getDirs()
|
|
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
|
require "lua_utils"
|
|
require "vlan_utils"
|
|
|
|
local json = require("dkjson")
|
|
sendHTTPContentTypeHeader('text/html')
|
|
|
|
-- Table parameters
|
|
local currentPage = _GET["currentPage"]
|
|
local perPage = _GET["perPage"]
|
|
local sortColumn = _GET["sortColumn"]
|
|
local sortOrder = _GET["sortOrder"]
|
|
|
|
local sortPrefs = "vlan"
|
|
|
|
if((sortColumn == nil) or (sortColumn == "column_"))then
|
|
sortColumn = getDefaultTableSort(sortPrefs)
|
|
else
|
|
if((sortColumn ~= "column_")
|
|
and (sortColumn ~= "")) then
|
|
tablePreferences("sort_"..sortPrefs,sortColumn)
|
|
end
|
|
end
|
|
|
|
if(sortOrder == nil) then
|
|
sortOrder = getDefaultTableSortOrder(sortPrefs)
|
|
else
|
|
if((sortColumn ~= "column_")
|
|
and (sortColumn ~= "")) then
|
|
tablePreferences("sort_order_"..sortPrefs,sortOrder)
|
|
end
|
|
end
|
|
|
|
if(currentPage == nil) then
|
|
currentPage = 1
|
|
else
|
|
currentPage = tonumber(currentPage)
|
|
end
|
|
|
|
if(perPage == nil) then
|
|
perPage = getDefaultTableSize()
|
|
else
|
|
perPage = tonumber(perPage)
|
|
tablePreferences("rows_number", perPage)
|
|
end
|
|
|
|
interface.select(ifname)
|
|
|
|
to_skip = (currentPage-1) * perPage
|
|
|
|
if(sortOrder == "desc") then sOrder = false else sOrder = true end
|
|
|
|
local vlans_stats = interface.getVLANsInfo(sortColumn, perPage, to_skip, sOrder,
|
|
false --[[high, but not higher details as there's no need for nDPI here --]])
|
|
|
|
local total_rows = 0
|
|
|
|
if(vlans_stats ~= nil) then
|
|
total_rows = vlans_stats["numVLANs"]
|
|
end
|
|
vlans_stats = vlans_stats["VLANs"]
|
|
|
|
local res_formatted = {}
|
|
|
|
for _, vlan in ipairs(vlans_stats) do
|
|
local record = vlan2record(getInterfaceId(ifname), vlan)
|
|
res_formatted[#res_formatted + 1] = record
|
|
end
|
|
|
|
local result = {}
|
|
result["perPage"] = perPage
|
|
result["currentPage"] = currentPage
|
|
result["totalRows"] = total_rows
|
|
result["data"] = res_formatted
|
|
result["sort"] = {{sortColumn, sortOrder}}
|
|
|
|
print(json.encode(result, nil))
|