towerops/lib/towerops
Graham McIntire 78b02936e8
feat: add comprehensive MikroTik wireless sensor discovery
Implements all 11 wireless sensor types for MikroTik RouterOS devices
to achieve parity with LibreNMS sensor discovery.

TIER 4 CRITICAL - MikroTik Wireless Monitoring Complete

## Sensor Types Implemented

### AP Sensors (mtxrWlApTable)
- Wireless clients (station count)
- CCQ (Connection Quality) with NV2 handling
- Frequency (MHz)
- Noise floor (dBm)
- TX/RX rate (bps)

### Station Sensors (mtxrWlStatTable)
- TX/RX CCQ (separate sensors)
- Frequency (MHz)
- TX/RX rate (bps)

### 60GHz Sensors (mtxrWl60GTable)
- Frequency (MHz)
- RSSI (dBm)
- Quality (%)
- PHY rate (bps with 1M divisor)

### 60GHz Station Sensors (mtxrWl60GStaTable)
- Distance (km with 100k divisor)

### LTE Modem Sensors (mtxrLTEModemTable)
- RSRQ (dB) - Reference Signal Received Quality
- RSRP (dBm) - Reference Signal Received Power
- SINR (dB) - Signal-to-Interference-plus-Noise Ratio

## Implementation Details

**Pattern**: Similar to UniFi frequency conversion - walks SNMP tables,
groups by index, builds sensor maps dynamically.

**LibreNMS Parity**:
- Matches exact OIDs from LibreNMS/OS/Routeros.php
- Implements same skip logic (CCQ when clients>0 && CCQ=0)
- Uses same frequency label extraction (first char + "G")
- Applies same divisors (60GHz rate: 1M, distance: 100k)

**Key Features**:
- Safe integer conversion (handles both string and int from SNMP)
- Frequency label extraction (2437 → "2G", 5180 → "5G")
- Smart sensor skipping (zero values, empty CCQ, etc.)
- Comprehensive test coverage (13 test cases)

## Files Modified

- lib/towerops/snmp/profiles/vendors/mikrotik.ex
  - Added discover_wireless_sensors/1 implementation
  - Added 5 helper functions for different MIB tables
  - Added group_by_index/1, freq_to_label/2, to_integer/1

- test/towerops/snmp/profiles/vendors/mikrotik_test.exs
  - Added 8 comprehensive test cases covering all sensor types
  - Tests skip logic, data handling, empty responses

## Testing

All 13 MikroTik vendor module tests pass.
All 1832 SNMP profile tests pass.

## Coverage Impact

MikroTik RouterOS wireless coverage: 0% → 100%
- Now discovers all 11 sensor types LibreNMS discovers
- Matches LibreNMS sensor OIDs, descriptions, divisors exactly

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 09:15:08 -06:00
..
accounts add device count to superadmin 2026-02-06 09:32:13 -06:00
admin feat: add audit logging to grant_sudo_mode/1 2026-02-01 14:09:40 -06:00
agent fix heartbeat validation rejecting git-describe version strings 2026-02-11 11:31:19 -06:00
agents fix siteless devices not inheriting org default agent 2026-02-11 12:20:53 -06:00
alerts feat: add Meraki/FortiWLC vendors, remove AlertNotifier temporarily 2026-01-22 10:40:44 -06:00
api_tokens refactor: use API token auth for profile imports instead of session cookies 2026-01-18 09:30:21 -06:00
contexts help update 2026-02-04 17:56:48 -06:00
devices add sensor value change events for all sensor types 2026-02-11 15:06:55 -06:00
ecto_types Fix all Credo issues 2026-02-06 10:31:09 -06:00
geoip remove Mix.env and support ip database import 2026-01-28 13:08:06 -06:00
job_monitoring more tests and fixes 2026-02-07 11:50:18 -06:00
mobile_sessions Fix datetime truncation for mobile session schemas 2026-01-15 16:17:05 -06:00
monitoring routeros fixes and latency rounding 2026-02-09 17:30:06 -06:00
organizations fix device count 2026-02-05 15:04:34 -06:00
profiles Reliability improvements: agent channel, polling, discovery, batch ops 2026-02-09 16:28:12 -06:00
proto Add agent restart and self-update commands 2026-02-10 13:06:10 -06:00
security fix 5 failing tests 2026-02-11 12:21:06 -06:00
settings remote agent/cloud improvements 2026-01-24 09:16:41 -06:00
sites tcp snmp test 2026-02-04 17:28:14 -06:00
snmp feat: add comprehensive MikroTik wireless sensor discovery 2026-02-12 09:15:08 -06:00
workers add sensor value change events for all sensor types 2026-02-11 15:06:55 -06:00
accounts.ex more dialyzer specs 2026-02-05 13:11:18 -06:00
admin.ex add device count to superadmin 2026-02-06 09:32:13 -06:00
agents.ex fix siteless devices not inheriting org default agent 2026-02-11 12:20:53 -06:00
alerts.ex more dialyzer specs 2026-02-05 13:11:18 -06:00
api_tokens.ex fix my-data page 2026-01-30 16:47:11 -06:00
application.ex Add 404-based brute force protection system 2026-02-10 16:31:48 -06:00
devices.ex fix siteless devices not inheriting org default agent 2026-02-11 12:20:53 -06:00
geoip.ex remove Mix.env and support ip database import 2026-01-28 13:08:06 -06:00
honeybadger_filter.ex filter more honeybadger alerts, format dates to users time zone, email template cleanup 2026-02-01 09:27:42 -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 repetitive SNMP MIB resolution errors 2026-02-08 14:09:26 -06:00
mailer.ex moduledocs 2026-01-17 15:08:49 -06:00
mobile_sessions.ex credo cleanup 2026-01-17 15:00:52 -06:00
monitoring.ex Replace conditionals with functional pattern matching 2026-02-10 17:11:37 -06:00
organizations.ex fix siteless devices not inheriting org default agent 2026-02-11 12:20:53 -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
settings.ex remote agent/cloud improvements 2026-01-24 09:16:41 -06:00
sites.ex more dialyzer specs 2026-02-05 13:11:18 -06:00
snmp.ex Reliability improvements: agent channel, polling, discovery, batch ops 2026-02-09 16:28:12 -06:00
vault.ex add mikrotik device handling 2026-02-01 16:42:39 -06:00