Possible bug fix for oid_key collision

closes #1044
This commit is contained in:
Larry Kim
2016-04-17 02:00:52 +09:00
committed by Cameron Sparr
parent a585119a67
commit 46543d6323
2 changed files with 6 additions and 1 deletions

View File

@@ -733,7 +733,11 @@ func (h *Host) HandleResponse(oids map[string]Data, result *gosnmp.SnmpPacket, a
break nextresult
}
}
if strings.HasPrefix(variable.Name, oid_key) {
// If variable.Name is the same as oid_key
// OR
// the result is SNMP table which "." comes right after oid_key.
// ex: oid_key: .1.3.6.1.2.1.2.2.1.16, variable.Name: .1.3.6.1.2.1.2.2.1.16.1
if variable.Name == oid_key || strings.HasPrefix(variable.Name, oid_key+".") {
switch variable.Type {
// handle Metrics
case gosnmp.Boolean, gosnmp.Integer, gosnmp.Counter32, gosnmp.Gauge32,