Modem: read uptime again, firewall drop counts, AT&T speed tests
Lint / JS (eslint) (push) Successful in 24s
Lint / Python (flake8) (push) Successful in 1m2s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 1m26s
Test / Python Tests (pytest) (push) Successful in 1m57s
Lint / Python (flake8) (pull_request) Successful in 1m25s
Lint / JS (eslint) (pull_request) Successful in 24s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 1m9s
Test / Python Tests (pytest) (pull_request) Successful in 1m14s

- Uptime: firmware 6.40 shows "Time Since Last Reboot" as D:HH:MM:SS,
  which the parser (expecting seconds) read as nothing, so uptime was
  blank and restart detection never fired. Both formats are read now.
- Firewall drops (logged in, every 5 minutes): the Logs page counted
  per hour for a day, split into incoming connections over the
  firmware's fixed flood limit (50 per second) and invalid packets. A
  lower bound, since the log keeps one entry per 2 s. Panel only.
- The modem's own speed test history (logged in, every 30 minutes):
  latest down and up results on the panel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-19 18:50:37 -05:00
1 parent 2a9111d8e8
commit 0370358363
6 files changed
+229 -9

No files matched your search

+12 -2
View File
@@ -498,6 +498,10 @@ Those limits are wide (warning at -27.9 dBm on a link that normally sits near -1
compares each reading to the link's own 7-day median to catch a damaged connector earlier. It stays quiet
until `rx_drift_min_samples` readings exist (about a day at a 5 minute poll).
Uptime comes from the System Information page without a login. Firmware 6.40 shows it as D:HH:MM:SS
(older firmware sent seconds; both are read). Uptime going backwards between polls records a restart, and
the panel shows it (*restarted ... by ...*).
Outages can be over between polls: two real ones lasted about two minutes against a 5 minute poll.
So WAN outages and modem restarts also come from the UniFi system log, and a drop in the modem's uptime
records a restart even if nothing logged it. A single short outage only appears in the panel's history.
@@ -512,7 +516,7 @@ the last hour. These are dashboard lines, not tickets, and they go once the hour
than 30 minutes is ignored.
**With `modem.access_code` set**, the monitor also logs in to the gateway (`ModemAdmin` in `modem.py`)
for two read-only checks, stored in `monitor_state.modem_checks`:
for read-only checks, stored in `monitor_state.modem_checks`:
- **NAT sessions** every 30 minutes, from the NAT Table page. Needs attention warns when 80% of the
gateway's sessions (32,767 on a BGW320) are in use, since new connections stall once it is full.
- **A ping from the gateway itself** to 1.1.1.1, from the Troubleshoot page, whenever UniFi flags the
@@ -521,6 +525,12 @@ for two read-only checks, stored in `monitor_state.modem_checks`:
ping is slow too, so the provider), *in the modem* (its ping is fine but ours through it is slow), or
*fine by then*. The result goes in the detail of the Internet line in Needs attention and on the
WAN / Fiber panel.
- **Firewall drops** every 5 minutes, from the Logs page, counted per hour for a day. Most are *FLOOD
limit 50pps*: AT&T's firmware caps new incoming connections at 50 per second (visitors to hosted
services, peers), with no setting to change it. The log records at most one drop every 2 seconds and
keeps about ten minutes, so the counts are a lower bound. Shown on the panel only.
- **The gateway's own speed tests** (AT&T runs them from the modem), read with the NAT check; the latest
down and up results are shown on the panel as a reference for what the line itself delivers.
The login posts md5(access code + nonce), as the gateway's own page does, so the code itself is never sent.
The session is kept between checks and renewed when it expires. A refused code is reported in Needs
@@ -937,7 +947,7 @@ Take LED colors from the model's quick start guide. See the comment at the top o
`recovery_notified` once the recovery note is on its ticket (column added automatically at monitor startup)
- `suppression_rules`: `active=FALSE` when removed; `expires_at` checked at query time
- `monitor_state`: key/value store; `interface_baseline`, `link_stats`, and `modem_stats` are JSON blobs
- `monitor_state` also holds `wan_history` (WAN outages, modem restarts), `wan_quality` (UniFi's 5 minute WAN health timeline), `modem_checks` (NAT sessions and the latest ping from the gateway) and `unifi_log_cursor` (how far the UniFi log has been read)
- `monitor_state` also holds `wan_history` (WAN outages, modem restarts), `wan_quality` (UniFi's 5 minute WAN health timeline), `modem_checks` (NAT sessions, the latest ping from the gateway, hourly firewall drops and its speed test results) and `unifi_log_cursor` (how far the UniFi log has been read)
- Database sessions run in UTC (`db.py`), whatever the server's time zone
- `modem_samples`: optical readings per poll, kept 90 days; created automatically at monitor startup
- `cutsheet_items`, `cutsheet_cables`, `cutsheet_port_labels`, `cutsheet_history`: cutsheet records and