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

closes #800
closes #801
This commit is contained in:
Matt Morrison 2016-03-07 17:13:29 +13:00 committed by Michele Fadda
parent 3b8eaeb234
commit 7914c34d1f
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
// and instance name
oid_asked := table.mappingTable
oid_next := oid_asked
need_more_requests := true
// Set max repetition
maxRepetition := uint8(32)
// Launch requests
for need_more_requests {
// Launch request
result, err3 := snmpClient.GetBulk([]string{oid_asked}, 0, maxRepetition)
result, err3 := snmpClient.GetBulk([]string{oid_next}, 0, maxRepetition)
if err3 != nil {
return err3
}
@ -572,6 +573,7 @@ func (h *Host) SNMPMap(acc telegraf.Accumulator) error {
// Determine if we need more requests
if strings.HasPrefix(lastOid, oid_asked) {
need_more_requests = true
oid_next = lastOid
} else {
need_more_requests = false
}