diff --git a/lib/towerops_web/channels/agent_channel.ex b/lib/towerops_web/channels/agent_channel.ex index 3e3ddb01..745a0e18 100644 --- a/lib/towerops_web/channels/agent_channel.ex +++ b/lib/towerops_web/channels/agent_channel.ex @@ -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