mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Fixes invalid totals for stacked charts
This commit is contained in:
parent
c54311c7de
commit
ea0eba2f6b
1 changed files with 17 additions and 0 deletions
|
|
@ -1401,8 +1401,12 @@ function rrd2json_merge(ret, num)
|
|||
|
||||
-- sort by "totalval" to get the top "num" results
|
||||
local by_totalval = {}
|
||||
local totalval = 0
|
||||
local minval = 0
|
||||
for i = 1, #ret do
|
||||
by_totalval[i] = ret[i].totalval
|
||||
-- update total
|
||||
totalval = totalval + ret[i].totalval
|
||||
end
|
||||
|
||||
local ctr = 0
|
||||
|
|
@ -1420,6 +1424,19 @@ function rrd2json_merge(ret, num)
|
|||
-- ret[1] possibly contains aggregated view statistics such as
|
||||
-- maxval and maxval_time or minval and minval_time
|
||||
ret[1].json = json
|
||||
|
||||
if #ret > 1 then
|
||||
-- update the total with the sum of the totals of each timeseries
|
||||
ret[1].totalval = totalval
|
||||
-- remove metrics that are no longer valid for merged rrds
|
||||
for _, k in pairs({'average',
|
||||
'minval', 'minval_time',
|
||||
'maxval', 'maxval_time',
|
||||
'lastval', 'lastval_time', 'percentile'}) do
|
||||
ret[1][k] = nil
|
||||
end
|
||||
end
|
||||
|
||||
-- io.write(json.."\n")
|
||||
return(ret[1])
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue