WAN degraded: a modem restart resets the judgement
Lint / JS (eslint) (push) Successful in 10s
Lint / Python (flake8) (push) Successful in 49s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Lint / JS (eslint) (pull_request) Successful in 11s
Lint / Python (flake8) (pull_request) Successful in 50s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (push) Successful in 1m8s
Test / Python Tests (pytest) (push) Successful in 1m21s
Security / Python Security (bandit) (pull_request) Successful in 1m5s
Test / Python Tests (pytest) (pull_request) Successful in 1m31s
Lint / JS (eslint) (push) Successful in 10s
Lint / Python (flake8) (push) Successful in 49s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Lint / JS (eslint) (pull_request) Successful in 11s
Lint / Python (flake8) (pull_request) Successful in 50s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (push) Successful in 1m8s
Test / Python Tests (pytest) (push) Successful in 1m21s
Security / Python Security (bandit) (pull_request) Successful in 1m5s
Test / Python Tests (pytest) (pull_request) Successful in 1m31s
Only health periods from 15 minutes after the latest restart count, so a slowdown the restart fixed neither opens a ticket on deploy nor holds one open. Replay: opens 11-24 01:30, resolves 04:20 after the reboot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a31437f2e5
commit
3e3069d2aa
4 files changed
+19
-2
No files matched your search
@@ -433,7 +433,7 @@ swap or recabling.
|
||||
| Modem pages unreadable, e.g. after a firmware update (≥`modem.failure_threshold`) | P3 |
|
||||
| UniFi logs that Smart Power auto power-cycled the modem | P3 |
|
||||
| UniFi logs that the WAN failed multiple times in 24 hours, and at least 2 of those drops aren't explained by a modem restart (decided 10 minutes later; at most one ticket a day) | P2 |
|
||||
| Internet degraded: at least `modem.degraded_fraction` (default half) of the last 2 hours' 5 minute periods slow, lossy or down by UniFi's WAN health. Closes with a recovery note once the last 2 hours are at most a quarter bad. | P2 |
|
||||
| Internet degraded: at least `modem.degraded_fraction` (default half) of the last 2 hours' 5 minute periods slow, lossy or down by UniFi's WAN health. Closes with a recovery note once the last 2 hours are at most a quarter bad. A modem restart resets it: only periods from 15 minutes after the latest restart count. | P2 |
|
||||
| An installed cable doesn't match the cutsheet (wrong neighbor, no link, missing port, port conflict) for `cutsheet.mismatch_ticket_hours` | P4 |
|
||||
|
||||
A failed Pulse ping check counts as "unknown": it neither raises nor resolves `host_unreachable`.
|
||||
|
||||
@@ -418,6 +418,8 @@ def recovered(periods: List[dict], newest: float) -> bool:
|
||||
|
||||
# Restart entries this close together are one restart (a reboot, then Smart Power, say).
|
||||
_EPISODE_GAP_S = 900
|
||||
# WAN health from this long after a restart reflects the modem as it now runs.
|
||||
RESTART_SETTLE_S = 900
|
||||
|
||||
|
||||
def restart_episodes(history: dict, button: Optional[dict], since: float) -> List[dict]:
|
||||
|
||||
+7
-1
@@ -2099,13 +2099,19 @@ class NetworkMonitor:
|
||||
if not periods:
|
||||
return # nothing fresh to judge by: leave any open alert as it is
|
||||
newest = periods[-1]['ts']
|
||||
episodes, lines, hint = self._restart_context(time.time())
|
||||
if episodes:
|
||||
# A restart resets the judgement: only what came after it (once it has settled)
|
||||
# counts, so a slowdown it fixed neither opens a ticket nor holds one open.
|
||||
periods = [p for p in periods if p['ts'] >= episodes[-1]['at'] + modem_api.RESTART_SETTLE_S]
|
||||
if not periods:
|
||||
return
|
||||
fraction = float((self.cfg.get('modem') or {}).get('degraded_fraction', modem_api.DEGRADED_FRACTION))
|
||||
bad = modem_api.degradation(periods, newest, fraction)
|
||||
if bad is None:
|
||||
if modem_api.recovered(periods, newest):
|
||||
db.resolve_event('wan_degraded', self.modem_name, '')
|
||||
return
|
||||
episodes, lines, hint = self._restart_context(time.time())
|
||||
parts = [f'{bad[s]} {s}' for s in ('latency', 'loss', 'down') if bad[s]]
|
||||
description = (f'The internet has been degraded for most of the last 2 hours: {bad["bad"]} of '
|
||||
f'{bad["total"]} five-minute periods had {", ".join(parts)} (UniFi WAN health).')
|
||||
|
||||
@@ -1240,6 +1240,15 @@ class TestWanDegraded:
|
||||
mon._process_wan_degraded(None, [])
|
||||
assert not db.upsert_event.called and not db.resolve_event.called
|
||||
|
||||
def test_a_restart_resets_the_judgement(self, mon, db):
|
||||
# 2026-11-24: hours of loss, then a reboot 50 minutes ago, fine since
|
||||
end = time.time()
|
||||
history = json.dumps({'outages': [], 'restarts': [{'at': end - 3000, 'by': None}]})
|
||||
db.get_state.side_effect = lambda k, d=None: history if k == 'wan_history' else None
|
||||
mon._process_wan_degraded(_timeline(['loss'] * 16 + ['down'] * 2 + ['ok'] * 6, end), [])
|
||||
assert not db.upsert_event.called
|
||||
db.resolve_event.assert_called_with('wan_degraded', 'att-modem', '')
|
||||
|
||||
def test_slow_ping_from_the_modem_is_mentioned(self, mon, db):
|
||||
checks = json.dumps({'ping': {'verdict': 'gateway', 'avg_ms': 1154}})
|
||||
db.get_state.side_effect = lambda k, d=None: checks if k == 'modem_checks' else None
|
||||
|
||||
Reference in new issue
Block a user