add node names from hostname, lldp, and snmp

populate local node name from hostname. extract system name from lldp packets and snmp sysname oid. call logtree after node merges.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ian Gulliver
2025-11-29 22:27:31 -08:00
parent ebfe18f84c
commit 0d36c21db2
5 changed files with 74 additions and 3 deletions

13
lldp.go
View File

@@ -55,7 +55,20 @@ func (t *Tendrils) handleLLDPPacket(ifaceName string, packet gopacket.Packet) {
mac := net.HardwareAddr(lldp.ChassisID.ID)
if !isBroadcastOrZero(mac) {
childPort := string(lldp.PortID.ID)
var systemName string
for _, opt := range lldp.Values {
if opt.Type == layers.LLDPTLVSysName {
systemName = string(opt.Value)
break
}
}
t.nodes.Update(nil, []net.HardwareAddr{mac}, ifaceName, childPort, "lldp")
if systemName != "" {
t.nodes.SetName(mac, systemName)
}
}
}
}