Add work completion indicator to ht_stats/stats/5min dump

This commit is contained in:
emanuele-f 2020-02-21 17:42:54 +01:00
parent 5276de4ca8
commit a428bb665f
16 changed files with 141 additions and 26 deletions

View file

@ -454,6 +454,14 @@ function ts_dump.run_5min_dump(_ifname, ifstats, config, when, verbose)
dumped_hosts[host_key] = true
end
if((num_processed_hosts % 64) == 0) then
if((not ntop.isDeadlineApproaching()) and (not ntop.rrd_is_slow())) then
local num_local = interface.getNumLocalHosts() -- note: may be changed
interface.setPeriodicActivityProgress(num_processed_hosts * 100 / num_local)
end
end
num_processed_hosts = num_processed_hosts + 1
end)
@ -461,6 +469,11 @@ function ts_dump.run_5min_dump(_ifname, ifstats, config, when, verbose)
traceError(TRACE_ERROR, TRACE_CONSOLE, "[".. _ifname .." ]" .. i18n("error_rrd_cannot_complete_dump"))
return false
end
if(in_time and (not ntop.isDeadlineApproaching()) and (not ntop.rrd_is_slow())) then
-- Here we assume that all the writes have completed successfully
interface.setPeriodicActivityProgress(100)
end
end
--tprint("Dump of ".. num_processed_hosts .. " hosts: completed in " .. (os.time() - dump_tstart) .. " seconds")