You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i use the method getBulk to get the interface list on the H3C device.
if i use snmpwalk tool to run this oid , it can display 50 interfaces, and use the gosnmp getBulk ,it just display 35 interfaces, i change the parameter maxRepetitions to 500 already.
The text was updated successfully, but these errors were encountered:
import (
"github.com/soniah/gosnmp"
"fmt"
)
func main() {
target := "your_device_ip"
community := "your_community_string"
oid := ".1.3.6.1.2.1.2.2.1.2" // Interface names OID
gosnmp.Default.Target = target
gosnmp.Default.Community = community
var startIndex = 0
var batchSize = 10 // Adjust this based on your device's capabilities
for {
results, err := gosnmp.Default.GetBulk(startIndex, batchSize, oid)
if err != nil {
fmt.Println("Error:", err)
break
}
if len(results.Variables) == 0 {
break // No more interfaces
}
// Process the retrieved interfaces here
// Update the startIndex for the next batch
startIndex = results.Variables[len(results.Variables)-1].Name
}
}
i use the method getBulk to get the interface list on the H3C device.
if i use snmpwalk tool to run this oid , it can display 50 interfaces, and use the gosnmp getBulk ,it just display 35 interfaces, i change the parameter maxRepetitions to 500 already.
The text was updated successfully, but these errors were encountered: