diff --git a/lib/towerops/workers/device_poller_worker.ex b/lib/towerops/workers/device_poller_worker.ex index b007b6c2..13693eb7 100644 --- a/lib/towerops/workers/device_poller_worker.ex +++ b/lib/towerops/workers/device_poller_worker.ex @@ -1115,12 +1115,28 @@ defmodule Towerops.Workers.DevicePollerWorker do defp build_client_opts(device) do snmp_config = Devices.get_snmp_config(device) - [ + base_opts = [ ip: device.ip_address, - community: snmp_config.community, version: snmp_config.version, port: device.snmp_port || 161 ] + + # Add version-specific credentials + if snmp_config.version == "3" do + v3_config = Devices.get_snmpv3_config(device) + + base_opts ++ + [ + security_name: v3_config.username, + security_level: v3_config.security_level, + auth_protocol: v3_config.auth_protocol, + auth_password: v3_config.auth_password, + priv_protocol: v3_config.priv_protocol, + priv_password: v3_config.priv_password + ] + else + base_opts ++ [community: snmp_config.community] + end end defp get_poll_interval(device) do