mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Fixes empty charts displayed
This commit is contained in:
parent
e1d0f369f7
commit
e13f4c13b7
6 changed files with 2351 additions and 1886 deletions
|
|
@ -1,7 +1,6 @@
|
|||
--
|
||||
-- (C) 2013-23 - ntop.org
|
||||
--
|
||||
|
||||
dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
|
|
@ -14,27 +13,34 @@ local graph_utils = require "graph_utils"
|
|||
local host_ip = _GET["host"]
|
||||
local vlan = _GET["vlan"]
|
||||
local host_stats = interface.getHostInfo(host_ip, vlan) or {}
|
||||
local total_traffic = 0
|
||||
local rsp = {
|
||||
labels = {},
|
||||
series = {},
|
||||
colors = {},
|
||||
labels = {},
|
||||
series = {},
|
||||
colors = {}
|
||||
}
|
||||
|
||||
if host_stats then
|
||||
local eth_stats = interface.getMacInfo(host_stats["mac"])
|
||||
local eth_stats = interface.getMacInfo(host_stats["mac"])
|
||||
|
||||
if eth_stats then
|
||||
local arp_sent = eth_stats["arp_requests.sent"] + eth_stats["arp_replies.sent"]
|
||||
local arp_rcvd = eth_stats["arp_requests.rcvd"] + eth_stats["arp_replies.rcvd"]
|
||||
if eth_stats then
|
||||
local arp_sent = eth_stats["arp_requests.sent"] + eth_stats["arp_replies.sent"]
|
||||
local arp_rcvd = eth_stats["arp_requests.rcvd"] + eth_stats["arp_replies.rcvd"]
|
||||
|
||||
rsp["labels"][1] = i18n("sent")
|
||||
rsp["series"][1] = arp_sent
|
||||
rsp["colors"][1] = graph_utils.get_html_color(1)
|
||||
total_traffic = arp_rcvd + arp_sent
|
||||
|
||||
rsp["labels"][2] = i18n("received")
|
||||
rsp["series"][2] = arp_rcvd
|
||||
rsp["colors"][2] = graph_utils.get_html_color(2)
|
||||
end
|
||||
rsp["labels"][1] = i18n("sent")
|
||||
rsp["series"][1] = arp_sent
|
||||
rsp["colors"][1] = graph_utils.get_html_color(1)
|
||||
|
||||
rsp["labels"][2] = i18n("received")
|
||||
rsp["series"][2] = arp_rcvd
|
||||
rsp["colors"][2] = graph_utils.get_html_color(2)
|
||||
end
|
||||
end
|
||||
|
||||
if total_traffic == 0 then
|
||||
rsp = {}
|
||||
end
|
||||
|
||||
rest_utils.answer(rest_utils.consts.success.ok, rsp)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue