Fixes asn and network score not formatted (#6461)

This commit is contained in:
MatteoBiscosi 2022-03-24 18:11:16 +01:00
parent eeaab5c918
commit 5b1dfa8d9a
2 changed files with 12 additions and 6 deletions

View file

@ -1,18 +1,20 @@
--
-- (C) 2013-22 - ntop.org
--
require "lua_utils"
local graph_utils = require "graph_utils"
local format_utils = require "format_utils"
-- Get from redis the throughput type bps or pps
local throughput_type = getThroughputType()
local now = os.time()
function network2record(ifId, network)
local record = {}
record["key"] = tostring(network["network_id"])
local network_link = "<A HREF='"..ntop.getHttpPrefix()..'/lua/hosts_stats.lua?network='..network["network_id"].."' title='"..network["network_key"].."'>"..getFullLocalNetworkName(network["network_key"])..'</A>'
record["column_id"] = network_link
record["column_score"] = network["score"] or 0
record["column_score"] = format_utils.formatValue(network["score"] or 0)
record["column_hosts"] = (network["num_hosts"] or 0)..""
local sent2rcvd = round((network["bytes.sent"] * 100) / (network["bytes.sent"] + network["bytes.rcvd"]), 0)