fix: only send SNMP jobs to agent for SNMP-enabled devices (#180)
- Check device.snmp_enabled before creating discovery/polling jobs - Also check snmp_enabled for MikroTik jobs - Prevents agent from attempting SNMP operations on ping-only devices - Fixes "Agent collected 0 OIDs" errors for devices without SNMP Reviewed-on: graham/towerops-web#180
This commit is contained in:
parent
6f6f1757ea
commit
0f3f16d443
1 changed files with 8 additions and 6 deletions
|
|
@ -969,18 +969,20 @@ defmodule ToweropsWeb.AgentChannel do
|
|||
end
|
||||
|
||||
defp build_jobs_for_device(device) do
|
||||
# Build SNMP job (discovery or polling)
|
||||
# Build SNMP job (discovery or polling) only if SNMP is enabled
|
||||
snmp_job =
|
||||
if needs_discovery?(device) do
|
||||
build_discovery_job(device)
|
||||
else
|
||||
build_polling_job(device)
|
||||
if device.snmp_enabled do
|
||||
if needs_discovery?(device) do
|
||||
build_discovery_job(device)
|
||||
else
|
||||
build_polling_job(device)
|
||||
end
|
||||
end
|
||||
|
||||
# Build MikroTik job only during discovery (not during regular polling)
|
||||
# MikroTik commands are discovery-type operations that should run once per 24h
|
||||
mikrotik_job =
|
||||
if needs_discovery?(device) and mikrotik_device?(device) do
|
||||
if device.snmp_enabled and needs_discovery?(device) and mikrotik_device?(device) do
|
||||
build_mikrotik_job(device)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue