mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-04 18:00:10 +00:00
Keeps InfluxDB export stats since startup
This commit is contained in:
parent
bfe7d6dbf7
commit
9f3bb73ddc
1 changed files with 15 additions and 3 deletions
|
|
@ -720,24 +720,32 @@ end
|
|||
|
||||
-- ##############################################
|
||||
|
||||
function inc_dropped_points(ifid, num_points)
|
||||
local function inc_dropped_points(ifid, num_points)
|
||||
inc_val(INFLUX_KEY_DROPPED_POINTS, ifid, num_points)
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function inc_exported_points(ifid, num_points)
|
||||
local function inc_exported_points(ifid, num_points)
|
||||
inc_val(INFLUX_KEY_EXPORTED_POINTS, ifid, num_points)
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function inc_exports(ifid)
|
||||
local function inc_exports(ifid)
|
||||
inc_val(INFLUX_KEY_EXPORTS, ifid, 1)
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
local function del_all_vals()
|
||||
ntop.delCache(INFLUX_KEY_DROPPED_POINTS)
|
||||
ntop.delCache(INFLUX_KEY_EXPORTED_POINTS)
|
||||
ntop.delCache(INFLUX_KEY_EXPORTS)
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function driver:get_dropped_points(ifid)
|
||||
return tonumber(ntop.getHashCache(INFLUX_KEY_DROPPED_POINTS, ifid)) or 0
|
||||
end
|
||||
|
|
@ -1628,6 +1636,10 @@ function driver:setup(ts_utils)
|
|||
local queries = {}
|
||||
local max_batch_size = 25 -- note: each query is about 400 characters
|
||||
|
||||
-- Clear saved values (e.g., number of exported points) as
|
||||
-- we want to start clean and keep values since-ntopng-startup
|
||||
del_all_vals()
|
||||
|
||||
-- Ensure that the database exists
|
||||
driver.init(self.db, self.url, nil, self.username, self.password)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue