mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Move SNMP iteration function to pro
This commit is contained in:
parent
fd2b5c385b
commit
2a1b30326d
1 changed files with 0 additions and 36 deletions
|
|
@ -189,42 +189,6 @@ function callback_utils.foreachLocalHost(ifname, deadline, callback)
|
|||
return true
|
||||
end
|
||||
|
||||
function callback_utils.foreachSNMPDevice(callback)
|
||||
if not ntop.isPro() or not callback then
|
||||
return
|
||||
end
|
||||
|
||||
local cbs = {}
|
||||
local snmpdevs = get_snmp_devices()
|
||||
|
||||
if type(callback) == "function" then
|
||||
cbs = {callback}
|
||||
elseif type(callback) == "table" and callback[1] ~= nil then
|
||||
cbs = callback
|
||||
end
|
||||
|
||||
for _, device in pairs(snmpdevs) do
|
||||
local snmp_device = require "snmp_device"
|
||||
snmp_device.init(device["ip"])
|
||||
|
||||
for _, cb in ipairs(cbs) do
|
||||
if ntop.isShutdown() then
|
||||
return true
|
||||
end
|
||||
|
||||
if isSNMPDeviceUnresponsive(device["ip"]) or is_snmp_polling_disabled(device["ip"]) then
|
||||
goto next_device
|
||||
end
|
||||
|
||||
if not cb(snmp_device) then
|
||||
goto next_device
|
||||
end
|
||||
end
|
||||
|
||||
::next_device::
|
||||
end
|
||||
end
|
||||
|
||||
-- Iterates each device on the ifname interface.
|
||||
-- Each device is passed to the callback with some more information.
|
||||
function callback_utils.foreachDevice(ifname, deadline, callback)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue