require "lua_utils" require "graph_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 = ""..getFullLocalNetworkName(network["network_key"])..'' record["column_id"] = network_link record["column_hosts"] = (network["num_hosts"] or 0).."" local sent2rcvd = round((network["bytes.sent"] * 100) / (network["bytes.sent"] + network["bytes.rcvd"]), 0) record["column_breakdown"] = "
Sent
Rcvd
" if(throughput_type == "pps") then record["column_thpt"] = pktsToSize(network["throughput_pps"]) else record["column_thpt"] = bitsToSize(8*network["throughput_bps"]) end record["column_traffic"] = bytesToSize(network["bytes.sent"] + network["bytes.rcvd"]) if not areInterfaceTimeseriesEnabled(ifId) then record["column_chart"] = "" else record["column_chart"] = '' end return record end