mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-05 02:16:39 +00:00
Merge branch 'dev' of https://github.com/ntop/ntopng into dev
This commit is contained in:
commit
40ca547758
8 changed files with 99 additions and 181 deletions
|
|
@ -688,6 +688,71 @@ function driver:_exportTsFile(fname)
|
|||
return rv
|
||||
end
|
||||
|
||||
local INFLUX_KEY_PREFIX = "ntopng.cache.ifid_%i."
|
||||
|
||||
-- ##############################################
|
||||
|
||||
local function get_dropped_points_key(ifid)
|
||||
return string.format(INFLUX_KEY_PREFIX.."dropped_points", ifid)
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
local function get_exported_points_key(ifid)
|
||||
return string.format(INFLUX_KEY_PREFIX.."exported_points", ifid)
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
local function get_exports_key(ifid)
|
||||
return string.format(INFLUX_KEY_PREFIX.."exports", ifid)
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
local function inc_val(k, val_to_add)
|
||||
local val = tonumber(ntop.getCache(k)) or 0
|
||||
|
||||
val = val + val_to_add
|
||||
ntop.setCache(k, string.format("%i", val))
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function inc_dropped_points(ifid, num_points)
|
||||
inc_val(get_dropped_points_key(ifid), num_points)
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function inc_exported_points(ifid, num_points)
|
||||
inc_val(get_exported_points_key(ifid), num_points)
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function inc_exports(ifid)
|
||||
inc_val(get_exports_key(ifid), 1)
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function driver:get_dropped_points(ifid)
|
||||
return tonumber(ntop.getCache(get_dropped_points_key(ifid))) or 0
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function driver:get_exported_points(ifid)
|
||||
return tonumber(ntop.getCache(get_exported_points_key(ifid))) or 0
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function driver:get_exports(ifid)
|
||||
return tonumber(ntop.getCache(get_exports_key(ifid))) or 0
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
local function deleteExportableFile(exportable)
|
||||
|
|
@ -704,7 +769,7 @@ end
|
|||
local function dropExportable(exportable)
|
||||
interface.select(exportable["ifid_str"])
|
||||
|
||||
interface.incInfluxDroppedPoints(exportable["num_points"])
|
||||
inc_dropped_points(exportable["ifid"], exportable["num_points"])
|
||||
deleteExportableFile(exportable)
|
||||
end
|
||||
|
||||
|
|
@ -713,7 +778,8 @@ end
|
|||
local function exportableSuccess(exportable)
|
||||
interface.select(exportable["ifid_str"])
|
||||
|
||||
interface.incInfluxExportedPoints(exportable["num_points"])
|
||||
inc_exported_points(exportable["ifid"], exportable["num_points"])
|
||||
inc_exports(exportable["ifid"])
|
||||
deleteExportableFile(exportable)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue