Optimizes second.lua callback

This commit is contained in:
Simone Mainardi 2017-11-22 13:11:11 +01:00
parent 3f56c8f799
commit 6e3cb6324f
19 changed files with 181 additions and 207 deletions

View file

@ -7,6 +7,7 @@ package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
require "flow_aggregation_utils"
local os_utils = require "os_utils"
local callback_utils = {}
@ -65,7 +66,7 @@ function callback_utils.foreachLocalHost(ifname, deadline, callback)
if host ~= nil then
if(host.localhost) then
local keypath = getPathFromKey(hostname)
hostbase = fixPath(dirs.workingdir .. "/" .. getInterfaceId(ifname) .. "/rrd/" .. keypath)
hostbase = os_utils.fixPath(dirs.workingdir .. "/" .. getInterfaceId(ifname) .. "/rrd/" .. keypath)
if(not(ntop.exists(hostbase))) then
ntop.mkdir(hostbase)
@ -100,7 +101,7 @@ function callback_utils.foreachDevice(ifname, deadline, callback)
end
local keypath = getPathFromKey(devicename)
local devicebase = fixPath(dirs.workingdir .. "/" .. getInterfaceId(ifname) .. "/rrd/" .. keypath)
local devicebase = os_utils.fixPath(dirs.workingdir .. "/" .. getInterfaceId(ifname) .. "/rrd/" .. keypath)
if(not(ntop.exists(devicebase))) then
ntop.mkdir(devicebase)