Add support for SNMP over TCP (#5870)
This commit is contained in:
committed by
Daniel Nelson
parent
b4a712969e
commit
378c570c06
@@ -623,6 +623,10 @@ func (s *Snmp) getConnection(idx int) (snmpConnection, error) {
|
||||
gs := gosnmpWrapper{&gosnmp.GoSNMP{}}
|
||||
s.connectionCache[idx] = gs
|
||||
|
||||
if strings.HasPrefix(agent, "tcp://") {
|
||||
agent = strings.TrimPrefix(agent, "tcp://")
|
||||
gs.Transport = "tcp"
|
||||
}
|
||||
host, portStr, err := net.SplitHostPort(agent)
|
||||
if err != nil {
|
||||
if err, ok := err.(*net.AddrError); !ok || err.Err != "missing port in address" {
|
||||
|
||||
Reference in New Issue
Block a user