towerops/lib/towerops
Graham McIntire 6fd03ace16
feat: add comprehensive wireless client tracking and monitoring
Implements real-time wireless client monitoring with historical tracking,
LiveView UI, proactive alerting, and cross-browser e2e tests.

Phase 1: Historical Tracking
- Add TimescaleDB hypertable for wireless_client_readings
- Batch insert client metrics every 60 seconds from DevicePollerWorker
- 90-day retention with compression after 7 days
- Continuous aggregates for hourly (1 year) and daily (5 years) rollups

Phase 2: LiveView UI
- Add wireless tab to device detail page
- Real-time client list with PubSub updates
- Signal strength and SNR badges with 5-level thresholds
- Display MAC, IP, subscriber, TX/RX rates, distance, uptime
- Subscriber matching via device_subscriber_links
- Empty state handling

Phase 3: Proactive Alerting
- WirelessInsightWorker runs every 5 minutes via Oban cron
- 4 insight types with auto-resolution:
  * wireless_signal_weak: < -75 dBm (warning), < -85 dBm (critical)
  * wireless_snr_low: < 15 dB (warning), < 10 dB (critical)
  * wireless_ap_overloaded: > 50 clients (warning), > 75 clients (critical)
  * wireless_client_missing: expected subscribers not connecting
- Hysteresis thresholds prevent alert flapping
- Multi-organization isolation with proper deduplication

Code Quality:
- Refactored reload_current_tab_data to reduce cyclomatic complexity
- Combined double Enum.filter into single pass for efficiency
- Fixed length/1 comparison to use empty list check
- All Credo checks passing

Testing:
- 28 unit tests (ExUnit) - 100% passing
- 15 e2e tests (Playwright) - 100% passing across chromium/firefox/webkit
- Total: 73 tests, all passing

Files changed:
- lib/towerops/workers/wireless_insight_worker.ex (NEW)
- lib/towerops_web/live/device_live/show.ex (wireless tab + refactoring)
- lib/towerops_web/live/device_live/show.html.heex (wireless template)
- lib/towerops/snmp.ex (5 new query functions)
- lib/towerops/gaiia.ex (list_missing_subscribers)
- lib/towerops/preseem/insight.ex (5 new insight types)
- config/runtime.exs (Oban cron schedule)
- test/support/fixtures/snmp_fixtures.ex (NEW)
- test/towerops/workers/wireless_insight_worker_test.exs (NEW)
- test/towerops_web/live/device_live/show_test.exs (9 new tests)
- e2e/tests/wireless-clients.spec.ts (NEW - 15 cross-browser tests)
2026-03-10 09:57:12 -05:00
..
accounts feat: auto-grant superuser to owner email addresses 2026-03-09 15:45:23 -05:00
admin feat: add Admin.update_global_pricing with Stripe integration 2026-03-06 13:55:12 -06:00
agent feat: add LLDP topology discovery support from agent 2026-03-05 11:16:28 -06:00
agents fix: cloud poller automatic rebalancing 2026-02-12 15:32:33 -06:00
alerts perf: add organization_id to alerts for fast single-table queries 2026-03-05 09:32:43 -06:00
api_tokens refactor: use API token auth for profile imports instead of session cookies 2026-01-18 09:30:21 -06:00
billing feat: add StripeClient.update_subscription_price 2026-03-06 13:50:11 -06:00
capacity feat: add backhaul capacity analysis foundation 2026-03-06 17:54:32 -06:00
config_changes refactor: fix all credo strict issues, format all code, fix broken routes 2026-02-13 19:34:40 -06:00
contexts help update 2026-02-04 17:56:48 -06:00
devices feat: add DeviceLink and DeviceLinkEvidence schemas 2026-02-12 12:49:11 -06:00
ecto_types add encrypted map ecto type for integration credentials 2026-02-12 16:52:05 -06:00
gaiia fix: correct subscriber counts by filtering CGNAT IPs and excluding routers 2026-02-18 09:15:10 -06:00
geoip remove Mix.env and support ip database import 2026-01-28 13:08:06 -06:00
integrations Store billing subscriber/MRR data on integrations for dashboard 2026-02-15 16:51:33 -06:00
job_monitoring more tests and fixes 2026-02-07 11:50:18 -06:00
maintenance Add maintenance windows and weather overlay (backend) 2026-02-16 10:01:19 -06:00
mobile_sessions security: implement comprehensive security audit fixes 2026-03-05 13:08:10 -06:00
monitoring fix: display count sensor values as integers instead of floats 2026-03-06 15:03:30 -06:00
netbox fix: validate NetBox URL scheme before making HTTP requests 2026-02-17 10:50:00 -06:00
organizations feat: per-organization billing override admin UI 2026-03-06 13:02:05 -06:00
pagerduty fix: resolve compilation errors, test failures, and credo issues 2026-02-14 12:23:10 -06:00
preseem feat: add comprehensive wireless client tracking and monitoring 2026-03-10 09:57:12 -05:00
profiles fix: handle FileSystem :ignore in ProfileWatcher for CI 2026-03-07 16:02:32 -06:00
proto feat: add LLDP topology discovery support from agent 2026-03-05 11:16:28 -06:00
security fix: resolve compilation errors, test failures, and credo issues 2026-02-14 12:23:10 -06:00
settings feat: add decimal type support to ApplicationSetting 2026-03-06 13:34:37 -06:00
sites feat: add geographic location to sites with geocoding, address fields, and Leaflet.js network map 2026-02-14 13:07:14 -06:00
snmp feat: add historical wireless client tracking with TimescaleDB 2026-03-09 17:42:17 -05:00
sonar Store billing subscriber/MRR data on integrations for dashboard 2026-02-15 16:51:33 -06:00
splynx Store billing subscriber/MRR data on integrations for dashboard 2026-02-15 16:51:33 -06:00
topology feat: implement LLDP topology discovery via SNMP 2026-03-05 10:53:57 -06:00
visp Store billing subscriber/MRR data on integrations for dashboard 2026-02-15 16:51:33 -06:00
weather Prevent Oban polling/monitoring job stacking per device 2026-02-16 16:37:48 -06:00
workers feat: add comprehensive wireless client tracking and monitoring 2026-03-10 09:57:12 -05:00
accounts.ex fix: NimbleTOTP base32 decoding and complete e2e test setup 2026-03-06 16:42:41 -06:00
activity_feed.ex fix: convert binary UUID to text in activity feed sync query 2026-03-06 17:33:34 -06:00
admin.ex feat: add Admin.update_global_pricing with Stripe integration 2026-03-06 13:55:12 -06:00
agents.ex fix: auto-dismiss agent offline insights when agent reconnects 2026-03-04 16:25:08 -06:00
alerts.ex feat: add real-time status emoji updates in page titles 2026-03-06 14:49:44 -06:00
api_tokens.ex fix my-data page 2026-01-30 16:47:11 -06:00
application.ex feat: add ErrorTrackerNotifier and fix PagerDuty notification handling 2026-03-09 13:14:30 -05:00
billing.ex feat: add best-effort subscription migration to new price 2026-03-06 13:52:28 -06:00
capacity.ex feat: add capacity insight worker, UI, and reporting views 2026-03-07 14:42:40 -06:00
config_changes.ex refactor: fix all credo strict issues, format all code, fix broken routes 2026-02-13 19:34:40 -06:00
dashboard.ex perf: optimize dashboard device count queries (partial N+1 fix) 2026-03-05 13:15:55 -06:00
devices.ex perf(tests): make device deletion delay configurable for faster tests 2026-03-06 08:04:08 -06:00
error_tracker_ignorer.ex Ignore pod shutdown errors in ErrorTracker 2026-02-17 10:59:51 -06:00
gaiia.ex feat: add comprehensive wireless client tracking and monitoring 2026-03-10 09:57:12 -05:00
geocoding.ex format 2026-02-14 13:57:25 -06:00
geoip.ex remove Mix.env and support ip database import 2026-01-28 13:08:06 -06:00
honeybadger_filter.ex fix: suppress benign shutdown errors during K8s pod rollouts 2026-02-12 12:16:40 -06:00
integrations.ex Store billing subscriber/MRR data on integrations for dashboard 2026-02-15 16:51:33 -06:00
job_monitoring.ex more tests and fixes 2026-02-07 11:50:18 -06:00
log_filter.ex Add comprehensive Dialyzer type specifications 2026-01-17 10:52:02 -06:00
logger_filters.ex fix: suppress benign shutdown errors during K8s pod rollouts 2026-02-12 12:16:40 -06:00
mailer.ex moduledocs 2026-01-17 15:08:49 -06:00
maintenance.ex Prevent Oban polling/monitoring job stacking per device 2026-02-16 16:37:48 -06:00
mobile_sessions.ex Security fixes: mask credentials in logs/API, fix cookie/CSP/LIKE injection/webhooks 2026-02-15 09:09:04 -06:00
monitoring.ex feat: add device list health indicators 2026-02-13 18:14:29 -06:00
organizations.ex fix: handle alert_changed PubSub messages and primary owner ordering 2026-03-07 12:04:30 -06:00
preseem.ex feat: add FluxCD image automation, fix Preseem duplicate AP crash 2026-02-14 10:30:12 -06:00
profiles.ex add universoal import 2026-01-18 16:59:34 -06:00
rate_limit.ex update hammer 2026-02-08 10:08:31 -06:00
redis_health_check.ex fix: remove to_charlist conversion for Redix host option 2026-01-24 17:49:57 -06:00
release.ex fix dialyzer things 2026-01-03 12:56:40 -06:00
repo.ex moduledocs 2026-01-17 15:08:49 -06:00
result.ex more tests 2026-02-03 13:20:33 -06:00
search.ex refactor: fix all credo strict issues, format all code, fix broken routes 2026-02-13 19:34:40 -06:00
settings.ex remote agent/cloud improvements 2026-01-24 09:16:41 -06:00
sites.ex Prevent Oban polling/monitoring job stacking per device 2026-02-16 16:37:48 -06:00
snmp.ex feat: add comprehensive wireless client tracking and monitoring 2026-03-10 09:57:12 -05:00
topology.ex feat: add LLDP topology discovery support from agent 2026-03-05 11:16:28 -06:00
trace.ex feat: add site search to trace 2026-03-06 15:37:23 -06:00
vault.ex add mikrotik device handling 2026-02-01 16:42:39 -06:00
weather.ex Prevent Oban polling/monitoring job stacking per device 2026-02-16 16:37:48 -06:00