diff --git a/checks.go b/checks.go index 3295d02..4b21e76 100644 --- a/checks.go +++ b/checks.go @@ -189,7 +189,7 @@ func executeDNSCheck(ctx context.Context, config *pb.DnsCheckConfig, timeoutMs u PreferGo: true, Dial: func(ctx context.Context, network, address string) (net.Conn, error) { d := net.Dialer{Timeout: timeout} - return d.DialContext(ctx, "udp", config.Server+":53") + return d.DialContext(ctx, "udp", net.JoinHostPort(config.Server, "53")) }, } } diff --git a/lldp.go b/lldp.go index 66095dc..8766ffa 100644 --- a/lldp.go +++ b/lldp.go @@ -36,7 +36,7 @@ func executeLldpTopologyJob(ctx context.Context, job *pb.AgentJob, resultCh chan snmpDev := job.SnmpDevice client, err := newSnmpConn(snmpDev) if err != nil { - slog.Error("failed to create SNMP client for LLDP", "job_id", jobID, "device_id", deviceID, "error", err) + slog.Error("failed to connect SNMP for LLDP", "job_id", jobID, "device_id", deviceID, "error", err) return } defer func() { @@ -45,11 +45,6 @@ func executeLldpTopologyJob(ctx context.Context, job *pb.AgentJob, resultCh chan } }() - if err := client.Connect(); err != nil { - slog.Error("SNMP connect failed for LLDP", "job_id", jobID, "device_id", deviceID, "error", err) - return - } - result, err := discoverLldpNeighbors(client, deviceID, jobID) if err != nil { slog.Error("LLDP discovery failed", "job_id", jobID, "device_id", deviceID, "error", err)