improve the error log message for snmp trap (#8552)

add OID value and source information into error log and make it easier for troubleshooting
This commit is contained in:
Peng Xiao 2020-12-23 16:12:41 +01:00 committed by GitHub
parent 35a221018b
commit 2c61fad895
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -284,7 +284,7 @@ func makeTrapHandler(s *SnmpTrap) handler {
if trapOid != "" {
e, err := s.lookup(trapOid)
if err != nil {
s.Log.Errorf("Error resolving V1 OID: %v", err)
s.Log.Errorf("Error resolving V1 OID, oid=%s, source=%s: %v", trapOid, tags["source"], err)
return
}
setTrapOid(tags, trapOid, e)
@ -322,7 +322,7 @@ func makeTrapHandler(s *SnmpTrap) handler {
var err error
e, err = s.lookup(val)
if nil != err {
s.Log.Errorf("Error resolving value OID: %v", err)
s.Log.Errorf("Error resolving value OID, oid=%s, source=%s: %v", val, tags["source"], err)
return
}
@ -340,7 +340,7 @@ func makeTrapHandler(s *SnmpTrap) handler {
e, err := s.lookup(v.Name)
if nil != err {
s.Log.Errorf("Error resolving OID: %v", err)
s.Log.Errorf("Error resolving OID oid=%s, source=%s: %v", v.Name, tags["source"], err)
return
}