Add per thread stats in the Ntop class. Add timeseries with cpu load per thread with 5s granularity.

This commit is contained in:
Alfredo Cardigliano 2026-02-25 10:18:07 +00:00
parent 5c224bec94
commit a19db8e13a
19 changed files with 171 additions and 21 deletions

View file

@ -33,12 +33,30 @@ function ts_dump.dump_cpu_stats(ifid, when)
}, when)
end
if cpu_load then
ts_utils.append("system:cpu_load", {
ifid = ifid,
load_percentage = cpu_load
}, when)
end
if cpu_load then
ts_utils.append("system:cpu_load", {
ifid = ifid,
load_percentage = cpu_load
}, when)
end
end
-- ########################################################
function ts_dump.dump_thread_cpu_stats(ifid, when)
local threads_info = ntop.threadsInfo()
if not threads_info then return end
for thread_name, stats in pairs(threads_info) do
local cpu_pct = stats["cpu_utilization_pct"]
if cpu_pct ~= nil then
ts_utils.append("system:thread_cpu_load", {
ifid = ifid,
thread_name = thread_name,
cpu_utilization_pct = cpu_pct
}, when)
end
end
end
-- ########################################################