mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-08 06:24:34 +00:00
Improve timeseries comments and fix Prometheus settings
This commit is contained in:
parent
7136ff6fbf
commit
c56b01b37e
4 changed files with 21 additions and 46 deletions
|
|
@ -1394,7 +1394,7 @@ function printStatsTimeseries()
|
|||
print('<tr><th colspan=2 class="info">'..i18n('prefs.timeseries_database')..'</th></tr>')
|
||||
|
||||
local elementToSwitch = {"ts_post_data_url", "influx_dbname", "influx_retention", "row_toggle_influx_auth", "influx_username", "influx_password", "row_ts_high_resolution"}
|
||||
local showElementArray = {false, true}
|
||||
local showElementArray = {false, true, false}
|
||||
|
||||
local javascriptAfterSwitch = "";
|
||||
javascriptAfterSwitch = javascriptAfterSwitch.." if($(\"#id-toggle-timeseries_driver\").val() == \"influxdb\") {\n"
|
||||
|
|
@ -1406,7 +1406,7 @@ function printStatsTimeseries()
|
|||
javascriptAfterSwitch = javascriptAfterSwitch.." $(\"#influx_password\").css(\"display\",\"none\");\n"
|
||||
javascriptAfterSwitch = javascriptAfterSwitch.." }\n"
|
||||
javascriptAfterSwitch = javascriptAfterSwitch.." $(\"#old_rrd_files_retention\").css(\"display\",\"none\");\n"
|
||||
javascriptAfterSwitch = javascriptAfterSwitch.." } else {\n"
|
||||
javascriptAfterSwitch = javascriptAfterSwitch.." } else if($(\"#id-toggle-timeseries_driver\").val() == \"rrd\") {\n"
|
||||
javascriptAfterSwitch = javascriptAfterSwitch.." $(\"#old_rrd_files_retention\").css(\"display\",\"table-row\");\n"
|
||||
javascriptAfterSwitch = javascriptAfterSwitch.." }\n"
|
||||
|
||||
|
|
@ -1964,6 +1964,24 @@ if tonumber(_POST["ts_high_resolution"]) ~= nil then
|
|||
end
|
||||
end
|
||||
|
||||
-- When high resolution timeseries are enabled, the ntopng C core creates
|
||||
-- timeseries rings with diffent slots. Each slot holds a snapshot of the
|
||||
-- host/interface timeseries in a given time interval. For example, if 10s
|
||||
-- resolution is choose, each slot holds a snapshot representing an interval
|
||||
-- of 10s. Periodically (in NetworkInterface::periodicStatsUpdate) the slots
|
||||
-- are polulated and then in minute.lua they are read and exported.
|
||||
--
|
||||
-- This Redis preferences tell the C core how to configure the ring:
|
||||
-- - ntopng.prefs.ts_write_slots: the number of slots to allocate in the ring
|
||||
-- - ntopng.prefs.ts_write_steps: how many ticks of NetworkInterface::periodicStatsUpdate
|
||||
-- are necessary to fill a slot.
|
||||
--
|
||||
-- For the example above of 10s resolution:
|
||||
-- - ntopng.prefs.ts_write_slots = 60 / 10 = 6 slots, + 1 extra slot as buffer (see above) = 7
|
||||
-- - ntopng.prefs.ts_write_steps = 60 / 6 slots = 10s / 5 (5s is the periodicStatsUpdate interval) = 2
|
||||
--
|
||||
-- See TimseriesRing.cpp for more details.
|
||||
--
|
||||
ntop.setPref("ntopng.prefs.ts_write_slots", tostring(math.ceil(new_slots)))
|
||||
ntop.setPref("ntopng.prefs.ts_write_steps", tostring(math.ceil(new_steps)))
|
||||
end
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ end
|
|||
|
||||
-- ##############################################
|
||||
|
||||
-- TODO remove after migrating to the new path format
|
||||
-- Maps second tag name to getRRDName
|
||||
local HOST_PREFIX_MAP = {
|
||||
host = "",
|
||||
|
|
@ -153,40 +152,6 @@ function driver.schema_get_full_path(schema, tags)
|
|||
return full_path
|
||||
end
|
||||
|
||||
-- TODO remove after migration
|
||||
function find_schema(rrdFile, rrdfname, tags, ts_utils)
|
||||
-- try to guess additional tags
|
||||
local v = string.split(rrdfname, "%.rrd")
|
||||
if((v ~= nil) and (#v == 1)) then
|
||||
local app = v[1]
|
||||
|
||||
if interface.getnDPIProtoId(app) ~= -1 then
|
||||
tags.protocol = app
|
||||
elseif interface.getnDPICategoryId(app) ~= -1 then
|
||||
tags.category = app
|
||||
end
|
||||
end
|
||||
|
||||
for schema_name, schema in pairs(ts_utils.getLoadedSchemas()) do
|
||||
-- verify tags compatibility
|
||||
for tag in pairs(schema.tags) do
|
||||
if tags[tag] == nil then
|
||||
goto next_schema
|
||||
end
|
||||
end
|
||||
|
||||
local full_path = driver.schema_get_full_path(schema, tags)
|
||||
|
||||
if full_path == rrdFile then
|
||||
return schema_name
|
||||
end
|
||||
|
||||
::next_schema::
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
local function getRRAParameters(step, resolution, retention_time)
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ end
|
|||
function ts_utils.getQueryDriver()
|
||||
local drivers = ts_utils.listActiveDrivers()
|
||||
|
||||
-- TODO: for now prefer the influx driver if present
|
||||
-- NOTE: prefer the InfluxDB driver if available, RRD as fallback
|
||||
local driver = drivers[2] or drivers[1]
|
||||
|
||||
return driver
|
||||
|
|
@ -288,12 +288,6 @@ function ts_utils.query(schema_name, tags, tstart, tend, options)
|
|||
return nil
|
||||
end
|
||||
|
||||
-- TODO: temporary fix for "process:memory"
|
||||
if schema_name == "process:memory" then
|
||||
tags = table.clone(tags)
|
||||
tags.ifid = nil
|
||||
end
|
||||
|
||||
if not schema:verifyTags(tags) then
|
||||
return nil
|
||||
end
|
||||
|
|
@ -740,7 +734,6 @@ end
|
|||
|
||||
-- ##############################################
|
||||
|
||||
-- TODO make standard and document
|
||||
function ts_utils.queryMean(schema_name, tstart, tend, tags, options)
|
||||
if not isUserAccessAllowed(tags) then
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue