Include multicast and broadcast packets in interface pps stats
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -90,7 +90,8 @@
|
|||||||
"Bash(git -C /home/flamingcow/multicast diff --name-only)",
|
"Bash(git -C /home/flamingcow/multicast diff --name-only)",
|
||||||
"Bash(du:*)",
|
"Bash(du:*)",
|
||||||
"Bash(tree:*)",
|
"Bash(tree:*)",
|
||||||
"Bash(go get:*)"
|
"Bash(go get:*)",
|
||||||
|
"Bash(go test:*)"
|
||||||
],
|
],
|
||||||
"ask": [
|
"ask": [
|
||||||
"Bash(rm *)"
|
"Bash(rm *)"
|
||||||
|
|||||||
11
snmp.go
11
snmp.go
@@ -204,7 +204,11 @@ func (t *Tendrils) queryInterfaceStats(snmp *gosnmp.GoSNMP, node *Node, ifNames
|
|||||||
ifHCInOctets := t.getInterfaceTable64(snmp, "1.3.6.1.2.1.31.1.1.1.6")
|
ifHCInOctets := t.getInterfaceTable64(snmp, "1.3.6.1.2.1.31.1.1.1.6")
|
||||||
ifHCOutOctets := t.getInterfaceTable64(snmp, "1.3.6.1.2.1.31.1.1.1.10")
|
ifHCOutOctets := t.getInterfaceTable64(snmp, "1.3.6.1.2.1.31.1.1.1.10")
|
||||||
ifHCInUcastPkts := t.getInterfaceTable64(snmp, "1.3.6.1.2.1.31.1.1.1.7")
|
ifHCInUcastPkts := t.getInterfaceTable64(snmp, "1.3.6.1.2.1.31.1.1.1.7")
|
||||||
|
ifHCInMcastPkts := t.getInterfaceTable64(snmp, "1.3.6.1.2.1.31.1.1.1.8")
|
||||||
|
ifHCInBcastPkts := t.getInterfaceTable64(snmp, "1.3.6.1.2.1.31.1.1.1.9")
|
||||||
ifHCOutUcastPkts := t.getInterfaceTable64(snmp, "1.3.6.1.2.1.31.1.1.1.11")
|
ifHCOutUcastPkts := t.getInterfaceTable64(snmp, "1.3.6.1.2.1.31.1.1.1.11")
|
||||||
|
ifHCOutMcastPkts := t.getInterfaceTable64(snmp, "1.3.6.1.2.1.31.1.1.1.12")
|
||||||
|
ifHCOutBcastPkts := t.getInterfaceTable64(snmp, "1.3.6.1.2.1.31.1.1.1.13")
|
||||||
|
|
||||||
poeStats := t.getPoEStats(snmp, ifNames)
|
poeStats := t.getPoEStats(snmp, ifNames)
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
@@ -240,12 +244,13 @@ func (t *Tendrils) queryInterfaceStats(snmp *gosnmp.GoSNMP, node *Node, ifNames
|
|||||||
stats.OutErrors = uint64(outErr)
|
stats.OutErrors = uint64(outErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
inPkts, hasInPkts := ifHCInUcastPkts[ifIndex]
|
|
||||||
outPkts, hasOutPkts := ifHCOutUcastPkts[ifIndex]
|
|
||||||
inBytes, hasInBytes := ifHCInOctets[ifIndex]
|
inBytes, hasInBytes := ifHCInOctets[ifIndex]
|
||||||
outBytes, hasOutBytes := ifHCOutOctets[ifIndex]
|
outBytes, hasOutBytes := ifHCOutOctets[ifIndex]
|
||||||
|
|
||||||
if hasInPkts && hasOutPkts && hasInBytes && hasOutBytes {
|
inPkts := ifHCInUcastPkts[ifIndex] + ifHCInMcastPkts[ifIndex] + ifHCInBcastPkts[ifIndex]
|
||||||
|
outPkts := ifHCOutUcastPkts[ifIndex] + ifHCOutMcastPkts[ifIndex] + ifHCOutBcastPkts[ifIndex]
|
||||||
|
|
||||||
|
if hasInBytes && hasOutBytes {
|
||||||
key := node.ID + ":" + name
|
key := node.ID + ":" + name
|
||||||
ifaceTracker.mu.Lock()
|
ifaceTracker.mu.Lock()
|
||||||
prev, hasPrev := ifaceTracker.counters[key]
|
prev, hasPrev := ifaceTracker.counters[key]
|
||||||
|
|||||||
Reference in New Issue
Block a user