New pro charts features and timeseries api (#1865)

* 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
This commit is contained in:
Emanuele Faranda 2018-07-18 15:09:19 +02:00 committed by GitHub
parent 2c641cf286
commit 4cbe45a948
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 5579 additions and 1765 deletions

View file

@ -274,7 +274,12 @@ function getPageUrl(base_url, params)
encoded[k] = urlencode(v)
end
return base_url .. "?" .. table.tconcat(encoded, "=", "&")
local delim = "&"
if not string.find(base_url, "?") then
delim = "?"
end
return base_url .. delim .. table.tconcat(encoded, "=", "&")
end
-- ##############################################
@ -2258,20 +2263,6 @@ function get_manufacturer_mac(mac_address)
return ret or "n/a"
end
-- rrd_exists
function rrd_exists(host_ip, rrdname)
if(host_ip == nil) then return false end
dirs = ntop.getDirs()
rrdpath = dirs.workingdir .. "/" .. ifId .. "/rrd/" .. getPathFromKey(host_ip) .. "/" .. rrdname
if(ntop.exists(rrdpath)) then return true end
-- Let's now try SNMP counters
rrdpath = dirs.workingdir .. "/" .. ifId .. "/snmpstats/" .. getPathFromKey(host_ip) .. "/" .. rrdname
-- print(rrdpath)
return ntop.exists(rrdpath)
end
-- getservbyport
function getservbyport(port_num, proto)
if(proto == nil) then proto = "TCP" end
@ -3238,6 +3229,54 @@ function printWarningAlert(message)
end
-- ###########################################
function tsQueryToTags(query)
local tags = {}
for _, part in pairs(split(query, ",")) do
local sep_pos = string.find(part, ":")
if sep_pos then
local k = string.sub(part, 1, sep_pos-1)
local v = string.sub(part, sep_pos+1)
tags[k] = v
end
end
return tags
end
function tsTagsToQuery(tags)
return table.tconcat(tags, ":", ",")
end
-- ###########################################
function splitUrl(url)
local params = {}
local parts = split(url, "?")
if #parts == 2 then
url = parts[1]
parts = split(parts[2], "&")
for _, param in pairs(parts) do
local p = split(param, "=")
if #p == 2 then
params[p[1]] = p[2]
end
end
end
return {
url = url,
params = params,
}
end
-- ###########################################
--
-- IMPORTANT
-- Leave it at the end so it can use the functions