add debug flags for arp, lldp, and snmp discovery

This commit is contained in:
Ian Gulliver
2026-01-17 21:12:21 -08:00
parent 3c8afa9bdf
commit e92a09e119
5 changed files with 29 additions and 0 deletions

12
snmp.go
View File

@@ -3,6 +3,7 @@ package tendrils
import (
"context"
"fmt"
"log"
"net"
"regexp"
"strings"
@@ -109,10 +110,17 @@ func (t *Tendrils) querySwitches() {
func (t *Tendrils) querySNMPDevice(ip net.IP) {
snmp, err := t.connectSNMP(ip)
if err != nil {
if t.DebugSNMP {
log.Printf("[snmp] %s: connect failed: %v", ip, err)
}
return
}
defer snmp.Conn.Close()
if t.DebugSNMP {
log.Printf("[snmp] %s: connected", ip)
}
t.querySysName(snmp, ip)
t.queryBridgeMIB(snmp, ip)
}
@@ -219,6 +227,10 @@ func (t *Tendrils) queryBridgeMIB(snmp *gosnmp.GoSNMP, deviceIP net.IP) {
}
}
if t.DebugSNMP {
log.Printf("[snmp] %s: mac=%s port=%s", deviceIP, mac, ifName)
}
if addToParent {
t.nodes.Update([]net.IP{deviceIP}, []net.HardwareAddr{mac}, "", "", "snmp")
} else {