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:
13
lldp.go
13
lldp.go
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user