mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
Possible fix for https curl error
This commit is contained in:
parent
9bdff1b170
commit
9108018c43
2 changed files with 20 additions and 3 deletions
|
|
@ -394,6 +394,7 @@ local function deserializeAmPrefs(host_key, val, config_only)
|
|||
local v = json.decode(val)
|
||||
|
||||
if v then
|
||||
rv.host_key = host_key
|
||||
rv.show_iface = false
|
||||
rv.ifname = v.ifname or ''
|
||||
rv.threshold = tonumber(v.threshold) or 500
|
||||
|
|
@ -425,7 +426,7 @@ end
|
|||
function am_utils.getHosts(config_only, granularity)
|
||||
local hosts = ntop.getHashAllCache(am_hosts_key) or {}
|
||||
local rv = {}
|
||||
|
||||
|
||||
for host_key, val in pairs(hosts) do
|
||||
local host = deserializeAmPrefs(host_key, val, config_only)
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,21 @@ local result = {}
|
|||
-- the hosts identifiers, whereas the table values contain host information
|
||||
-- see (am_utils.key2host for the details on such format).
|
||||
local function check(measurement, hosts, granularity)
|
||||
package.path = dirs.installdir .. "/pro/scripts/lua/enterprise/modules/?.lua;" .. package.path
|
||||
local infrastructure_utils = require "infrastructure_utils"
|
||||
result[measurement] = {}
|
||||
|
||||
for key, host in pairs(hosts) do
|
||||
if host.is_infrastructure then
|
||||
local infrastructure_instance = infrastructure_utils.get_instance_by_host(host.host)
|
||||
|
||||
if infrastructure_instance then
|
||||
local _, protocol = infrastructure_utils.getHostAndHTTPMeasurement(infrastructure_instance.url)
|
||||
host.host = protocol .. '://' .. host.host
|
||||
measurement = protocol
|
||||
end
|
||||
end
|
||||
|
||||
local domain_name = host.host
|
||||
|
||||
if do_trace then
|
||||
|
|
@ -55,10 +67,14 @@ local function check(measurement, hosts, granularity)
|
|||
|
||||
local bandwidth = (download_bit / total_time) / 1000000
|
||||
|
||||
if not result[measurement] then
|
||||
result[measurement] = {}
|
||||
end
|
||||
|
||||
result[measurement][key] = {
|
||||
value = bandwidth,
|
||||
value = bandwidth,
|
||||
resolved_addr = rv.RESOLVED_IP,
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue