towerops/lib/towerops/snmp
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
..
adapters fix: agent discovery and polling accuracy improvements 2026-02-11 15:58:31 -06:00
profiles feat: add comprehensive MikroTik wireless sensor discovery 2026-02-12 09:15:08 -06:00
adapter.ex enable agent debugging 2026-01-27 13:25:04 -06:00
agent_discovery.ex nif ci fix complie in ci 2026-01-30 13:01:44 -06:00
arp_discovery.ex arp 2026-01-23 08:40:57 -06:00
arp_entry.ex arp 2026-01-23 08:40:57 -06:00
client.ex Replace conditionals with functional pattern matching 2026-02-10 17:11:37 -06:00
deferred_discovery.ex agent debug improvements 2026-01-27 14:21:50 -06:00
device.ex better discovery 2026-01-22 17:40:58 -06:00
discovery.ex fix: deduplicate sensors with leading-dot OID differences 2026-02-11 16:12:15 -06:00
interface.ex add network map 2026-01-25 15:24:35 -06:00
interface_stat.ex moduledocs 2026-01-17 15:08:49 -06:00
ip_address.ex feat: add IP address discovery (Phase 1.3) 2026-01-21 10:36:19 -06:00
mac_address.ex mac discovery 2026-01-23 09:22:08 -06:00
mac_discovery.ex mac discovery 2026-01-23 09:22:08 -06:00
memory_pool.ex feat: add memory pool and storage discovery (Phase 1.5) 2026-01-21 10:57:08 -06:00
mib_parser.ex add MIB-based validation and generic profile tests 2026-01-08 08:57:21 -06:00
mib_translator.ex complete overhaul of snmp engine to C nif 2026-01-30 12:27:12 -06:00
neighbor.ex moduledocs 2026-01-17 15:08:49 -06:00
neighbor_cleanup_worker.ex Add strict typespecs to all Oban worker perform/1 functions 2026-02-06 09:50:51 -06:00
neighbor_discovery.ex arp 2026-01-23 08:40:57 -06:00
physical_entity.ex feat: add physical inventory discovery (Phase 1.4) 2026-01-21 10:46:27 -06:00
poller.ex snmp overhaul 2026-01-18 16:00:01 -06:00
poller_behaviour.ex snmp bits 2026-01-03 14:41:28 -06:00
processor.ex sanitize snmp data and fix some cpu things 2026-01-22 16:53:01 -06:00
processor_reading.ex sanitize snmp data and fix some cpu things 2026-01-22 16:53:01 -06:00
sanitizer.ex sanitize snmp data and fix some cpu things 2026-01-22 16:53:01 -06:00
sensor.ex moduledocs 2026-01-17 15:08:49 -06:00
sensor_change_detector.ex add sensor value change events for all sensor types 2026-02-11 15:06:55 -06:00
sensor_reading.ex track more snmp things 2026-01-28 09:18:31 -06:00
snmp_behaviour.ex complete overhaul of snmp engine to C nif 2026-01-30 12:27:12 -06:00
state_sensor.ex add state sensor schema, migration, and discovery 2026-01-21 10:25:01 -06:00
storage.ex feat: add memory pool and storage discovery (Phase 1.5) 2026-01-21 10:57:08 -06:00
storage_reading.ex fix mikrotik sensors 2026-01-22 18:07:20 -06:00
vlan.ex add VLAN schema, migration, and discovery 2026-01-21 10:31:21 -06:00