mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
Improves grafana label visualization
This commit is contained in:
parent
07301d01cd
commit
4ad439f934
3 changed files with 14 additions and 10 deletions
|
|
@ -31,6 +31,8 @@ else
|
|||
local res = {}
|
||||
|
||||
for _, t in pairs(_GRAFANA["payload"]["targets"]) do
|
||||
if t["target"] == nil then t["target"] = "" end
|
||||
|
||||
local is_host = string.starts(t["target"] or '', "host_")
|
||||
|
||||
local addr
|
||||
|
|
@ -58,12 +60,16 @@ else
|
|||
local totalval = rr["totalval"]
|
||||
rr = json.decode(rr["json"])
|
||||
|
||||
local label = ifname
|
||||
if is_host then label = addr..", "..label end
|
||||
label = "["..label.."]"
|
||||
|
||||
if is_allprotos then
|
||||
res = toSeries(rr)
|
||||
toSeries(rr, res, label)
|
||||
elseif string.ends(t["target"], "traffic_total_bytes") or string.ends(t["target"], "traffic_total_packets") then
|
||||
res[#res + 1] = {target="Total", datapoints={{totalval, 0 --[[ it's an integral, an instant is not meaningful here --]]}}}
|
||||
else
|
||||
res = toSeries(rr)
|
||||
toSeries(rr, res, label)
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue