mirror of https://github.com/aredn/aredn.git
Wireless monitoring improvements (#1222)
* Wireless monitor runs an emergeny wifi scan at 3am to recover forgotten nodes. LQM no longer tries to ping stations which have disconnected.
This commit is contained in:
parent
8507fbc250
commit
d6a652df31
|
@ -132,7 +132,7 @@ function should_nonpair_block(track)
|
||||||
end
|
end
|
||||||
|
|
||||||
function should_ping(track)
|
function should_ping(track)
|
||||||
if not track.ip or is_user_blocked(track) then
|
if not track.ip or is_user_blocked(track) or track.lastseen < now then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if track.type == "Tunnel" or track.type == "Wireguard" then
|
if track.type == "Tunnel" or track.type == "Wireguard" then
|
||||||
|
|
|
@ -51,7 +51,8 @@ local action_limits = {
|
||||||
unresponsive_trigger1 = 5,
|
unresponsive_trigger1 = 5,
|
||||||
unresponsive_trigger2 = 10,
|
unresponsive_trigger2 = 10,
|
||||||
zero_trigger1 = 10 * 60, -- 10 minutes
|
zero_trigger1 = 10 * 60, -- 10 minutes
|
||||||
zero_trigger2 = 30 * 60 -- 30 minutes
|
zero_trigger2 = 30 * 60, -- 30 minutes
|
||||||
|
default_scan = 3 -- 3am
|
||||||
}
|
}
|
||||||
-- Start action state assuming the node is active and no actions are pending
|
-- Start action state assuming the node is active and no actions are pending
|
||||||
local action_state = {
|
local action_state = {
|
||||||
|
@ -73,6 +74,7 @@ local station_count = {
|
||||||
history = {},
|
history = {},
|
||||||
history_limit = 120 -- 2 hours
|
history_limit = 120 -- 2 hours
|
||||||
}
|
}
|
||||||
|
local default_scan_enabled = true
|
||||||
|
|
||||||
-- Detect Mikrotik AC which requires special handling
|
-- Detect Mikrotik AC which requires special handling
|
||||||
local mikrotik_ac = false
|
local mikrotik_ac = false
|
||||||
|
@ -186,6 +188,18 @@ end
|
||||||
-- Take action depending on the monitor state
|
-- Take action depending on the monitor state
|
||||||
|
|
||||||
function M.run_actions()
|
function M.run_actions()
|
||||||
|
|
||||||
|
-- Once per day we do a wifi scan as a fallback for failed connections
|
||||||
|
local time = os.date("*t")
|
||||||
|
if time.hour == action_limits.default_scan then
|
||||||
|
if default_scan_enabled then
|
||||||
|
default_scan_enabled = false
|
||||||
|
M.reset_network("scan-all")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
default_scan_enabled = true
|
||||||
|
end
|
||||||
|
|
||||||
-- No action if we have stations and they're responsive
|
-- No action if we have stations and they're responsive
|
||||||
if station_count.last_nonzero > station_count.last_zero and unresponsive.max < action_limits.unresponsive_trigger1 then
|
if station_count.last_nonzero > station_count.last_zero and unresponsive.max < action_limits.unresponsive_trigger1 then
|
||||||
for k, _ in pairs(action_state)
|
for k, _ in pairs(action_state)
|
||||||
|
|
Loading…
Reference in New Issue