[SNMP Input] SNMPMap() loops forever if table has more than 32 entries

This commit is contained in:
Matt Morrison 2016-03-07 17:13:29 +13:00
parent 35f1e28809
commit 1c36781c84
1 changed files with 3 additions and 1 deletions

View File

@ -464,13 +464,14 @@ func (h *Host) SNMPMap(acc telegraf.Accumulator) error {
// To get mapping between instance id // To get mapping between instance id
// and instance name // and instance name
oid_asked := table.mappingTable oid_asked := table.mappingTable
oid_next := oid_asked
need_more_requests := true need_more_requests := true
// Set max repetition // Set max repetition
maxRepetition := uint8(32) maxRepetition := uint8(32)
// Launch requests // Launch requests
for need_more_requests { for need_more_requests {
// Launch request // Launch request
result, err3 := snmpClient.GetBulk([]string{oid_asked}, 0, maxRepetition) result, err3 := snmpClient.GetBulk([]string{oid_next}, 0, maxRepetition)
if err3 != nil { if err3 != nil {
return err3 return err3
} }
@ -572,6 +573,7 @@ func (h *Host) SNMPMap(acc telegraf.Accumulator) error {
// Determine if we need more requests // Determine if we need more requests
if strings.HasPrefix(lastOid, oid_asked) { if strings.HasPrefix(lastOid, oid_asked) {
need_more_requests = true need_more_requests = true
oid_next = lastOid
} else { } else {
need_more_requests = false need_more_requests = false
} }