mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Implement getLatestTimestamp API
This commit is contained in:
parent
b2107b6f36
commit
20e8b4aaca
4 changed files with 34 additions and 12 deletions
|
|
@ -319,6 +319,7 @@ end
|
|||
|
||||
function driver:export()
|
||||
local system_iface_id = -1
|
||||
local exported = false
|
||||
|
||||
while(true) do
|
||||
local name_id = ntop.lpopCache("ntopng.influx_file_queue")
|
||||
|
|
@ -344,9 +345,30 @@ function driver:export()
|
|||
|
||||
-- delete the file manually
|
||||
os.remove(fname)
|
||||
exported = false
|
||||
break
|
||||
else
|
||||
exported = true
|
||||
end
|
||||
end
|
||||
|
||||
if exported then
|
||||
local k = "ntopng.cache.influxdb_export_time_" .. self.db
|
||||
ntop.setCache(k, tostring(os.time()))
|
||||
end
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function driver:getLatestTimestamp()
|
||||
local k = "ntopng.cache.influxdb_export_time_" .. self.db
|
||||
local v = tonumber(ntop.getCache(k))
|
||||
|
||||
if v ~= nil then
|
||||
return v
|
||||
end
|
||||
|
||||
return os.time()
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue