fix: respect device SNMP version for agent polling instead of forcing v2c (#166)
Devices configured as SNMPv1 were being force-upgraded to v2c for agent polling, which breaks devices that don't support v2c (returning empty OID responses and no throughput/capacity data). Reviewed-on: graham/towerops-web#166
This commit is contained in:
parent
68354af021
commit
dba9a286d3
1 changed files with 9 additions and 6 deletions
|
|
@ -1083,14 +1083,17 @@ defmodule ToweropsWeb.AgentChannel do
|
|||
defp build_v2c_snmp_device(device, snmp_config) do
|
||||
community = snmp_config.community || ""
|
||||
|
||||
# Always use v2c for agent polling — Counter64 (HC counters) can't be
|
||||
# encoded in SNMPv1 responses, causing 64-bit counter queries to fail.
|
||||
# v2c uses the same community string and is supported by virtually all
|
||||
# SNMP-capable devices. Without HC counters, 32-bit counters on fast
|
||||
# links wrap undetectably (full cycle in ~69s at 500 Mbps).
|
||||
# Use v2c when possible for HC (64-bit) counter support, but respect
|
||||
# the device's configured version — some devices only support v1.
|
||||
version =
|
||||
case device.snmp_version do
|
||||
"1" -> "1"
|
||||
_ -> "2c"
|
||||
end
|
||||
|
||||
%SnmpDevice{
|
||||
ip: device.ip_address,
|
||||
version: "2c",
|
||||
version: version,
|
||||
port: device.snmp_port || 161,
|
||||
community: community
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue