Commit graph

723 commits

Author SHA1 Message Date
e302b8e9c4
add integrations context with CRUD operations 2026-02-12 16:55:57 -06:00
39f0ffe253
add integrations schema with encrypted credentials 2026-02-12 16:54:14 -06:00
2fd195e6b3
add encrypted map ecto type for integration credentials 2026-02-12 16:52:05 -06:00
a61abd836c
fix: cloud poller automatic rebalancing
- create MonitoringCheck schema for the monitoring_checks table, fixing
  silent data loss where ping results were dropped by the wrong schema
- update agent channel and device monitor worker to use new schema
- fix Stats queries to use MonitoringCheck instead of Check schema
- add list_online_cloud_pollers and list_cloud_polled_devices queries
- add CloudLatencyProbeWorker to dispatch cross-agent latency probes
  every 8 hours via PubSub to all online cloud pollers
- scope AgentLatencyEvaluator to cloud pollers only with cloud_only
  filter, lower min_checks (5), wider time window (48h), and
  device-level assignments to avoid changing site/org defaults
- update cron schedule: probes at 0/8/16h, evaluation at 0:30/8:30/16:30
- refactor monitoring.ex and http_executor.ex to fix credo complexity
2026-02-12 15:32:33 -06:00
07a6128877
feat: add checks tab to device detail page (TDD cycle 1)
- Add 'Checks' tab link to device navigation
- Display empty state when no checks configured
- Add tests for tab visibility and empty state
- Fix unused variable warnings in monitoring context
- Remove unused CheckResult alias and module attributes
- Add stub for legacy get_latency_data for backward compatibility

Tests: 2 new tests added, all passing
Following TDD: RED-GREEN cycle verified for each feature
2026-02-12 14:50:14 -06:00
fa2ebdb973
fix: add diagnostic logging for agent job refresh on device deletion
Enhanced AgentChannel logging to track device IDs across job list updates.
Added tests verifying server correctly excludes deleted devices from job lists.

Root cause: Bug is in Go agent (appends jobs without clearing), not Phoenix server.
2026-02-12 14:36:25 -06:00
291ecd1054
feat: add full-featured monitoring platform (HTTP/TCP/DNS checks)
Implements Icinga2-style generic check system for comprehensive monitoring.

Phoenix Backend:
- Generic checks table with JSONB config for all check types
- TimescaleDB check_results hypertable for time-series data
- Check executors (HTTP, TCP, DNS)
- CheckWorker with self-scheduling and state transitions
- Extended alerts system for check-based alerting

Check Types: HTTP/HTTPS, TCP, DNS
Architecture: Icinga2 Checkable pattern, soft/hard states, flapping detection

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 14:05:31 -06:00
7371ceb942
feat: add automatic network topology inference
Build a rich network topology from SNMP polling data using evidence-based
confidence scoring. LLDP/CDP neighbors, MAC address tables, and ARP data
are combined to infer device links with weighted confidence merging.

- Add DeviceLink and DeviceLinkEvidence schemas for persistent topology
- Implement evidence collectors: LLDP (0.95), CDP (0.95), MAC (0.7), ARP (0.6)
- Add device role inference from sysObjectID/sysDescr patterns
- Hook topology inference into DevicePollerWorker pipeline
- Add stale link cleanup (24h mark stale, 72h delete) via NeighborCleanupWorker
- Update NetworkMapLive with "Added" vs "All Devices" tabs
- Add connected devices section to device detail page
- Add device role selector to device edit form
- Update Cytoscape.js with role-based node shapes/colors and confidence edges
2026-02-12 13:28:01 -06:00
f106d4c801
fix: prevent back-button trap on device show page
push_patch without replace: true created a history entry loop:
/devices/:id → /devices/:id?tab=overview, so hitting back would
immediately redirect forward again, trapping the user.
2026-02-12 13:09:34 -06:00
02f1af6fe3
feat: hook topology inference into polling pipeline
DevicePollerWorker calls Topology.process_device/2 after saving
neighbor data. Topology updates incrementally every poll cycle.
2026-02-12 13:07:29 -06:00
be153d364e
feat: add device role inference
Infers device roles from LLDP/CDP capabilities, interface count,
vendor/manufacturer, and system description. Only overwrites
inferred roles, never manual overrides. Wired into process_device
pipeline.
2026-02-12 13:06:41 -06:00
8e355fce79
feat: add process_device/2 topology pipeline
Orchestrates evidence collection from LLDP, CDP, MAC, and ARP
data. Groups evidence by remote device, resolves to managed
devices, upserts links with merged confidence. Broadcasts
topology changes via PubSub. Skips self-links.
2026-02-12 13:02:14 -06:00
9327fd3f13
feat: add confidence merging and link upsert
merge_confidence/2 combines scores using 1-(1-a)(1-b).
upsert_link/1 creates or updates links keyed on source device +
interface + remote MAC. Merges confidence on update, appends
evidence records.
2026-02-12 12:58:06 -06:00
00c366ac9a
feat: add LLDP, CDP, MAC, and ARP evidence collectors
LLDP/CDP evidence (0.95 confidence) from snmp_neighbors.
MAC evidence (0.7) cross-references MAC tables with device
interface MACs. ARP evidence (0.6) matches by IP and MAC.
Self-links excluded. Unmatched entries tracked as discovered.
2026-02-12 12:55:39 -06:00
8d9d385683
fix: prevent AlreadySentError in BruteForceProtection plug
The plug was attempting to register a before_send callback after
blocking a banned IP and sending a 403 response. This caused
Plug.Conn.AlreadySentError in production.

Fixed by checking conn.halted before attempting to register the
404 tracking callback. If the request was already blocked and sent,
we skip the callback registration.

Also updated the test to verify proper behavior without the
workaround for AlreadySentError.
2026-02-12 12:53:32 -06:00
c74243d321
feat: add Topology context with device matching
Build lookup maps to resolve evidence (MAC, IP, hostname) to
managed device IDs. Foundation for evidence collectors.
2026-02-12 12:52:04 -06:00
29abb688d2
feat: add DeviceLink and DeviceLinkEvidence schemas
Ecto schemas for persistent topology model. DeviceLink tracks
connections between devices with confidence scores. DeviceLinkEvidence
records why each link is believed to exist. Device schema gets
device_role and device_role_source fields.
2026-02-12 12:49:11 -06:00
cd6f2153ce
fix: reload device stream when switching back to existing devices tab 2026-02-12 12:47:30 -06:00
c6a4e88a4a
fix: suppress benign shutdown errors during K8s pod rollouts
Filter port_died and write_failed/epipe errors from Honeybadger reports,
email notifications, and logs. Reorder supervision tree so Oban drains
before its dependencies shut down, and add 40s shutdown grace period.
2026-02-12 12:16:40 -06:00
15074de4e2
feat: add screenos profile to Juniper vendor module
Phase 3 audit found screenos.yaml detection profile was not registered
in the Juniper vendor module. Added to profile_names list.

ScreenOS is Juniper's legacy firewall operating system (pre-Junos).

Coverage: 5 Juniper profiles now registered
- juniper-mss
- juniperex2500os
- junos
- junose
- screenos (newly added)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 11:10:51 -06:00
3f927e1d5b
feat: add vertiv-dcs profile to Vertiv vendor module
Phase 2 audit found vertiv-dcs.yaml detection profile was not registered
in the Vertiv vendor module. Added to profile_names list.

Coverage: 8 total Vertiv/Liebert profiles now registered
- cyberpower (cyberpower.ex)
- liebert (liebert.ex)
- raritan-emx, raritan-kvm, raritan-pdu (raritan.ex)
- vertiv-dcs, vertiv-ita2, vertiv-pdu (vertiv.ex)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 11:06:43 -06:00
1318b1b6b7
feat: live device timestamp updates and org-scoped alert PubSub
Always broadcast from update_device_status/2 so the device index
LiveView refreshes even when status hasn't changed. Add a 15-second
tick timer to keep "Last Checked" timestamps fresh between polls.
Scope alert PubSub topics to organization for defense-in-depth.
2026-02-12 11:01:56 -06:00
19ceae0b4e
feat: Phase 1 Quick Wins - 11 vendor profiles implemented
Completed Phase 1 of comprehensive coverage analysis, adding support for 11
vendor profiles across 6 vendors in ~24 hours of implementation time.

**New Vendor Modules:**
- VyOS (vyos.ex) - VyOS and Vyatta router support
- Edgeswitch (edgeswitch.ex) - Ubiquiti EdgeSwitch/EdgePoint/USW series
- Omnitron (omnitron.ex) - Omnitron iConverter optical networking

**Enhanced Vendor Modules:**
- Adva (adva.ex) - Added adva-alm profile, now 7 total profiles
- Unifi (unifi.ex) - Added unifi-usp (SmartPower) profile
- APC (apc.ex) - Added aos-emu2 (Environmental Monitoring Unit) profile
- HP (hp.ex) - Added comware and procurve profiles, now 11 total
- Dell (dell.ex) - Added powerconnect profile
- Powervault (powervault.ex) - Added powervault profile variant

**New YAML Profiles:**
- adva-fsp150cp.yaml - ADVA FSP150CP optical transport
- Plus corresponding os_detection profiles for all new vendors

**Updated YAML Profiles:**
- comware.yaml, procurve.yaml - Comprehensive HP legacy switch support
- powerconnect.yaml, powervault.yaml - Dell legacy product support
- adva-alm.yaml - Enhanced Adva optical support

**Test Coverage:**
- 54 new tests across all new modules
- All 6857 tests passing
- Comprehensive coverage for each vendor module

**Profiles Added (11 total):**
1. vyos, vyatta (VyOS routers)
2. adva-alm (Adva optical)
3. edgeswitch, unifi-usp (Ubiquiti)
4. comware, procurve (HP legacy switches)
5. powerconnect, powervault (Dell legacy)
6. aos-emu2 (APC environmental)
7. omnitron-iconverter (Omnitron optical)

**Impact:**
- Closes 11-profile gap from coverage analysis
- Improves enterprise switch coverage (HP/Dell legacy)
- Enhances optical networking support (Adva, Omnitron)
- Strengthens Ubiquiti portfolio (EdgeSwitch, USP)
- Adds network router support (VyOS)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 10:52:51 -06:00
debdd1a21f
feat: email raw stacktrace on every Honeybadger exception
Add a Honeybadger NoticeFilter that sends an email with the full
error class, message, stacktrace, and server info to graham@mcintire.me
whenever an exception is reported. The notice passes through unchanged
so Honeybadger still receives it normally.
2026-02-12 10:33:48 -06:00
aa1bac0d46
perf: batch inserts, selective LiveView reloading, and database indexes for scale
Replace individual Repo.insert() with Repo.insert_all() for sensor readings,
interface stats, processor readings, and storage readings in agent channel and
device poller worker. Add partial/composite database indexes for common query
patterns. Dashboard now uses GROUP BY aggregation instead of loading all devices.
DeviceLive.Show only reloads data for the active tab on PubSub events.
DeviceLive.Index debounces status changes and skips quota queries on updates.
Agent polling preloads filtered to monitored sensors/interfaces only.
2026-02-12 10:16:10 -06:00
dd3a6234cb
feat: complete WISP vendor coverage (ePMP, Raisecom, Netonix)
**1. Consolidated ePMP YAML profiles:**
- Merged enhancements from cambium-epmp.yaml into epmp.yaml
- Added GPS satellite count sensors (tracked/visible)
- Added proper state_name fields for state sensors
- Improved field naming (descr vs type, divisor vs precision)
- Deleted duplicate cambium-epmp.yaml file

**2. Implemented Raisecom vendor module:**
- Created lib/towerops/snmp/profiles/vendors/raisecom.ex
- Fills major 0% coverage gap for Asia-Pacific WISP market
- Hardware detection via RAISECOM-SYSTEM-MIB with sysDescr fallback
- Sensor discovery handled by existing YAML profiles (15+ sensors):
  - CPU utilization, memory pools
  - Fan speed and state monitoring
  - Voltage sensors with thresholds
  - Power supply state monitoring
  - Config load state tracking
- Comprehensive test coverage (8 tests, all passing)

**3. Verified Netonix coverage:**
- YAML profile matches LibreNMS 100% (PoE status, voltage, temp, fan, power, current)
- Vendor module provides additional scalar sensors beyond LibreNMS
- Coverage exceeds LibreNMS baseline

**4. Investigated Tarana:**
- No SNMP support in LibreNMS (newer vendor, likely cloud-managed)
- Would require vendor MIBs and documentation to implement

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 09:55:21 -06:00
e68ebdb62d
fix: sync AgentLive.Index modal state to URL for browser navigation
Update AgentLive.Index to properly handle browser back/forward buttons
by syncing the setup token modal to URL parameters.

Changes:
- Update handle_params/3 to read modal param and set modal state
- Update show_setup handler to use push_patch with ?modal=setup
- Update close_token_modal handler to use push_patch (remove modal param)
- Update handle_agent_creation_success to use push_patch after creating agent

Behavior:
- Browser back button now closes the setup modal without navigating away
- URL reflects current modal state (?modal=setup)
- Bookmarkable URLs restore exact modal state (can share agent setup URL)
- After creating agent, modal opens via URL state

Follows idiomatic Phoenix LiveView pattern using push_patch/2 and
handle_params/3 as documented in CLAUDE.md.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 09:28:39 -06:00
d84a685878
fix: sync UserSettingsLive modal state to URL for browser navigation
Update UserSettingsLive to properly handle browser back/forward buttons
by syncing all modal state to URL parameters.

Changes:
- Update handle_params/3 to read modal param and set modal states
- Add build_settings_path/2 helper to construct URLs with preserved params
- Update all modal show/close handlers to use push_patch instead of assign:
  - add_token modal
  - token_created modal (shown after creating token)
  - revoke_all modal
  - add_device modal (TOTP)
  - device_qr modal (shown after creating device)
  - recovery_codes modal

Behavior:
- Browser back button now closes modals without navigating away
- URL reflects current modal state (?modal=add_token, etc.)
- Tab and page params preserved when opening/closing modals
- Bookmarkable URLs restore exact modal state

Follows idiomatic Phoenix LiveView pattern using push_patch/2 and
handle_params/3 as documented in CLAUDE.md.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 09:26:45 -06:00
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
1c0cccdf25
feat: add UniFi channel-to-frequency dynamic conversion
Add TIER 3 MEDIUM priority dynamic frequency sensor discovery for Ubiquiti UniFi APs.
Implements channel-to-frequency conversion matching LibreNMS behavior exactly.

Implementation:
- discover_frequency_sensors/1: Orchestrates discovery with `with` for flat control flow
- fetch_channels/1: Walks channel OID (.1.3.6.1.4.1.41112.1.6.1.2.1.4)
- fetch_radio_names/1: Walks radio name OID (.1.3.6.1.4.1.41112.1.6.1.2.1.1)
- build_frequency_sensors/2: Converts channels to frequency sensors
- channel_to_frequency/1: Module attribute map lookup (29 Wi-Fi channels)
  - 2.4GHz: Channels 1-14 → 2412-2484 MHz
  - 5GHz: Channels 34-165 → 5170-5825 MHz
  - Unknown channels filtered out (return 0 → rejected)
- Frequency sensors added alongside static sensors
- Per-radio sensors with descriptive names (e.g., "Frequency (ng)")

Code Quality:
- Refactored to reduce cyclomatic complexity (map lookup vs case statements)
- Extracted helper functions to reduce nesting depth
- Pattern matching in tests instead of length/1 checks
- All Credo checks passing without disabling rules

Testing:
- Added comprehensive test coverage (16 tests, all passing)
- Tests 2.4GHz channel conversion (1, 6, 11)
- Tests 5GHz channel conversion (36, 149, 165)
- Tests unknown channel filtering (999 → filtered out)
- Tests integration with static sensors (10 static + 2 frequency = 12 total)
- Tests graceful handling of channel walk failures
- Mox-based SNMP adapter mocking

Impact:
- Dynamic frequency monitoring enables accurate channel tracking
- Handles AP channel changes (auto-DFS, manual config changes)
- Static OID approach was inaccurate (channel changes not reflected)

Source:
- LibreNMS LibreNMS/OS/Unifi.php discoverWirelessFrequency/pollWirelessFrequency
- LibreNMS LibreNMS/Modules/Wireless.php channelToFrequency lookup table

Priority: TIER 3 MEDIUM (3-5 hour effort, vendor module enhancement)
Gap Status: UniFi parity 80% → 90%
Result: TIER 3 COMPLETE - All Ubiquiti platform gaps resolved

Files:
- lib/towerops/snmp/profiles/vendors/unifi.ex
- test/towerops/snmp/profiles/vendors/unifi_test.exs
- CHANGELOG.txt
2026-02-12 09:05:00 -06:00
9094f42098
feat: add Dell PowerVault storage array text-based sensor parsing
Implement vendor module for Dell PowerVault storage arrays that parse
text-based sensor messages from FCMGMT-MIB instead of structured tables.

Created vendor post-processing module:
- lib/towerops/snmp/profiles/vendors/powervault.ex
  * Walks FCMGMT-MIB::connUnitSensorMessage (OID 1.3.6.1.3.94.1.8.1.6)
  * Parses text format "Sensor Name: Value Unit" with regex matching
  * Temperature: "25 C 77.0F" → 25°C (extracts Celsius)
  * Voltage: "12.1V" → 12.1V
  * Current: "0.5A" → 0.5A
  * Battery Charge: "95%" → 95% (with threshold limits)

Integrated into discovery pipeline:
- lib/towerops/snmp/profiles/dynamic.ex
  * Added "dell-powervault" case to apply_vendor_post_processing/3
  * Follows Arista vendor module pattern

Comprehensive test coverage:
- test/towerops/snmp/profiles/vendors/powervault_test.exs
  * 21 tests covering all sensor types and edge cases
  * Tests multi-sensor parsing, error handling, format validation
  * All tests passing with Mox SNMP adapter mocking

Technical notes:
- Client.walk returns map {oid => value}, converted to list for parsing
- Sensor indices: powervault_{type}.{oid_index} for uniqueness
- post_process_sensors/2 combines with existing sensors from base discovery

Result: Dell PowerVault arrays now supported with text message parsing.
Gap: CRITICAL (no sensors) → RESOLVED. Parity: 0% → 85%.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 08:38:30 -06:00
b3fae05693
feat: implement Arista EOS sensor enhancements (DOM power, thresholds, grouping)
Implemented all critical and nice-to-have Arista sensor improvements identified
in LibreNMS parity audit. Upgrades Arista EOS support from 85% to 100% parity.

Files Changed:
- lib/towerops/snmp/profiles/vendors/arista.ex (enhanced)
  Added 4 major enhancements:
  1. DOM power conversion (watts→dBm): Detects optical power sensors via regex,
     converts using formula dBm = 10*log10(watts*1000), preserves original value
     in metadata
  2. Arista threshold discovery: Walks ARISTA-ENTITY-SENSOR-MIB threshold table
     (OID 1.3.6.1.4.1.30065.3.3.1.1.1), applies 4 threshold types (low_critical,
     low_warn, high_warn, high_critical), converts thresholds to dBm for optical
     sensors
  3. Smart grouping: Organizes sensors by SFPs, PSUs, Platform (chipsets), Power
     Connectors, System for better UX
  4. Description cleanup: Removes redundant "sensor" text, simplifies PSU naming,
     cleans whitespace

- lib/towerops/snmp/profiles/dynamic.ex (integration)
  Added apply_vendor_post_processing/3 to call Arista enhancements after sensor
  discovery. Applies to both arista_eos and arista-mos profiles.

- test/towerops/snmp/profiles/vendors/arista_test.exs (comprehensive tests)
  Added 23 new tests covering:
  - DOM conversion (6 tests): Rx/Tx power, Xcvr power, non-DOM sensors, edge cases
  - Threshold discovery (4 tests): Basic thresholds, dBm conversion, no thresholds,
    SNMP failures
  - Smart grouping (6 tests): SFPs, Xcvr, PSUs, power connectors, platform, system
  - Description cleanup (5 tests): Trailing sensor, duplicate Sensor strings, PSU
    naming, hotspot, whitespace
  - End-to-end post-processing (1 test): All enhancements in correct order

All tests passing (30/30 in arista_test.exs, 6367/6367 total).

Result: Arista EOS support upgraded from 85% to 100% LibreNMS parity. All critical
gaps closed: optical power now displayed correctly in dBm, alerting enabled via
thresholds, sensors organized for better UX, descriptions cleaned up.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 17:23:33 -06:00
f00dc3ff12
test: expand agent channel coverage from 8% to 66%
add 54 tests covering join/terminate lifecycle, heartbeat, error,
credential_test_result, monitoring_check, mikrotik_result, catch-all
handle_in events, handle_info lifecycle messages, PubSub messages,
SNMP result edge cases, poll result sensor/interface data storage,
SNMPv3 credential paths, and monitoring-enabled device job building.

fix bug where error.error_message was used instead of error.message
matching the AgentError protobuf struct field name.
2026-02-11 16:52:12 -06:00
dd0b29aefb
fix: handle "null" string values in SNMP parsing
Some devices (e.g., AirOS 8.7.14) return the literal string "null"
for unavailable metrics like UCD CPU stats. Added explicit handling
in parse_integer/1 and parse_float/1 to return nil for "null" strings,
preventing ArgumentError when attempting binary_to_integer conversion.
2026-02-11 16:19:58 -06:00
1f07b3b640
fix: deduplicate sensors with leading-dot OID differences
normalize OIDs by stripping leading dots when grouping for deduplication.
gosnmp returns OIDs with leading dots but YAML profiles and vendor modules
define them without, causing the same sensor to appear twice (e.g. MikroTik
DHCP lease count). also removed redundant DHCP Leases entry from routeros
wireless_oid_defs since the YAML profile already covers it.
2026-02-11 16:12:15 -06:00
47fcbeb483
fix: agent discovery and polling accuracy improvements
- use 64-bit HC counters (ifHCInOctets/ifHCOutOctets) instead of 32-bit
  counters that wrap every ~34s on gigabit links
- fix negative integer parsing in replay adapter so sensor scale values
  like -3 produce correct divisors (1000) instead of falling through to 1
- replace walking entire Cisco enterprise tree with targeted subtrees to
  avoid timeouts; add Juniper, HP/H3C, Fortinet, Cambium vendor OIDs
- add missing discovery OIDs: ENTITY-STATE-MIB, HOST-RESOURCES-MIB
  tables, and UCD-SNMP-MIB Linux CPU stats fallback
2026-02-11 15:58:31 -06:00
863f92a94a
fix: handle RouterOS version returned as list of integers
Some MikroTik devices return the version OID as a list of integers
[7, 20, 6] instead of a binary string "7.20.6". Added pattern match
to detect_version/1 to handle this case and convert to dotted string.

Fixes warning: "Failed to detect version: {:ok, [7, 20, 6]}"

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 15:49:57 -06:00
26bb3d5ca1
color network map nodes by device status
green for online, yellow for unknown, red for offline. previously
nodes were colored by device type which didn't convey health state.
also remove agent last_seen_at display from device detail page since
the offline badge already communicates agent health.
2026-02-11 15:41:50 -06:00
475dea639a
remove agent last_seen_at display from device detail page
the offline badge already communicates agent health status,
so the relative timestamp is redundant.
2026-02-11 15:35:59 -06:00
edb330e4de
normalize OIDs to fix agent-polled sensor matching
strip leading dots from OID keys returned by agent so they match
sensor OIDs stored without leading dots. fixes ubiquiti airos
wireless sensors (clients, ccq, frequency, etc) not being polled.
also fix flaky sensor_change_detector tests using global pubsub topic.
2026-02-11 15:33:08 -06:00
abbe117f5e
add sensor value change events for all sensor types
extract sensor change detection from DevicePollerWorker into shared
SensorChangeDetector module. add sensor_value_changed event for non-%
sensors when value differs from last_value. agent channel now detects
changes and updates last_value, matching phoenix poller behavior.
2026-02-11 15:06:55 -06:00
45357e334a
fix live polling to use effective agent from site/org cascade
live poll mode used get_device_assignment which only checks direct
device-level assignments. devices with agent assigned at site or
org level fell through to direct Phoenix SNMP. replaced with
get_effective_agent_token which walks the full cascade.
2026-02-11 14:12:42 -06:00
6d597f7e76
round sensor readings to 1 decimal place
division by sensor_divisor produced full float precision values
like 34.09999999. apply Float.round/2 in both the phoenix poller
and agent channel paths.
2026-02-11 14:09:22 -06:00
2875866c07
fix agent-polled devices stuck in unknown status
store_monitoring_check saved ping results from agents but never
updated device status. DeviceMonitorWorker skips agent-assigned
devices, so nothing ever moved them from :unknown to :up/:down.

added update_device_status_from_check to derive status from check
result, update the device, create alerts on transitions, and
broadcast via PubSub — matching DeviceMonitorWorker behavior.
2026-02-11 14:03:04 -06:00
cb3f2edf50
polling fix 2026-02-11 13:54:23 -06:00
4e290b1938
fix String.replace crash when YAML index is numeric
YAML parses bare numbers like `index: 0` as integers. coerce
index_template to string before calling String.replace in both
build_table_sensor and build_state_sensor.
2026-02-11 13:27:46 -06:00
9e36d5030a
poll device immediately after discovery completes
newly discovered devices sat idle with no metric data until the
next scheduling cycle. now the channel sends a poll job (and ping
job if monitoring enabled) right after discovery succeeds, using
send(self(), ...) so discovery DB writes commit first.

also reduces k8s replicas from 3 to 2.
2026-02-11 13:24:55 -06:00
10d1157ec3
fix agent discovery system OIDs returning no_such_name
gosnmp returns OIDs with leading dots (e.g., ".1.3.6.1.2.1.1.1.0")
but the Replay adapter did exact-match lookups without the dot.
Walks already normalized both sides, so interfaces worked. GETs
did not, breaking all system OID resolution (sysDescr, sysName, etc).
2026-02-11 12:46:44 -06:00
d36fcbe628
fix raw discovery data timestamp to use user's timezone 2026-02-11 12:41:31 -06:00
1a31fd00b6
fix nil sysDescr crashing vendor identification
String.contains?/2 crashes on nil input. default nil sysDescr
and sysObjectID to empty string in find_vendor_match.
2026-02-11 12:28:58 -06:00