polling fix

This commit is contained in:
Graham McIntire 2026-02-11 13:54:23 -06:00
parent 4e290b1938
commit cb3f2edf50
No known key found for this signature in database
3 changed files with 23 additions and 1 deletions

11
CHANGELOG.txt Normal file
View file

@ -0,0 +1,11 @@
CHANGELOG - towerops-web
========================
2026-02-11 - fix: update last_snmp_poll_at for agent-polled devices
- File: lib/towerops_web/channels/agent_channel.ex (process_polling_result/3)
- Bug: Devices polled by remote agents showed "Last Polled: Never" because
process_polling_result never called Devices.update_snmp_poll_time/1
- The Phoenix-side DevicePollerWorker already had this call (line 172),
but the agent channel path was missing it
- Fix: Added Devices.update_snmp_poll_time(device) at the top of
process_polling_result/3, matching the DevicePollerWorker pattern

View file

@ -1010,4 +1010,13 @@ When writing new LiveView code or JavaScript hooks:
- assets are rebuilt automatically on filesystem change - assets are rebuilt automatically on filesystem change
- never try to run npm, it's not included in phoenix - never try to run npm, it's not included in phoenix
- assets build themselves on file change, you do not need to ever run mix assets.build - assets build themselves on file change, you do not need to ever run mix assets.build
- never write custom one-off tests, if you're going to write a test, write a proper exunit test - never write custom one-off tests, if you're going to write a test, write a proper exunit test
## Changelog
After every code change, append an entry to `CHANGELOG.txt` in the project root. Each entry must include:
- Date (YYYY-MM-DD)
- Short description (e.g. "fix: update last_snmp_poll_at for agent-polled devices")
- Files changed and a brief explanation of what and why
Keep entries in reverse chronological order (newest at top, below the header). Never remove existing entries.

View file

@ -1303,6 +1303,8 @@ defmodule ToweropsWeb.AgentChannel do
end end
defp process_polling_result(device, result, _socket) do defp process_polling_result(device, result, _socket) do
Devices.update_snmp_poll_time(device)
snmp_device = device.snmp_device snmp_device = device.snmp_device
oid_values = Map.new(result.oid_values) oid_values = Map.new(result.oid_values)
# Use server time to avoid clock drift issues between agents # Use server time to avoid clock drift issues between agents