Skip to content

Commit

Permalink
Revert "fix: snmp marshal error (influxdata#10322)"
Browse files Browse the repository at this point in the history
This reverts commit 8a9fbfd.
  • Loading branch information
nward committed Jan 12, 2022
1 parent 921746d commit bba6e38
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions internal/snmp/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func ClearCache() {

func LoadMibsFromPath(paths []string, log telegraf.Logger) error {
once.Do(gosmi.Init)
modules := []string{}

for _, mibPath := range paths {
folders := []string{}
Expand Down Expand Up @@ -80,7 +79,9 @@ func LoadMibsFromPath(paths []string, log telegraf.Logger) error {
if info.IsDir() {
appendPath(path)
} else if info.Mode()&os.ModeSymlink == 0 {
modules = append(modules, info.Name())
if err := loadModule(info.Name()); err != nil {
log.Warn(err)
}
}
return nil
})
Expand All @@ -89,12 +90,6 @@ func LoadMibsFromPath(paths []string, log telegraf.Logger) error {
}
}
}
for _, module := range modules {
err := loadModule(module)
if err != nil {
log.Warnf("module %v could not be loaded", module)
}
}
return nil
}

Expand Down Expand Up @@ -174,11 +169,7 @@ func SnmpTranslateCall(oid string) (mibName string, oidNum string, oidText strin
return oid, oid, oid, oid, out, err
}

if oidNum = out.RenderNumeric(); oidNum == "" {
return oid, oid, oid, oid, out, fmt.Errorf("cannot make %v numeric, please ensure all imported mibs are in the path", oid)
}

oidNum = "." + oidNum + end
oidNum = "." + out.RenderNumeric() + end
} else if strings.ContainsAny(oid, "abcdefghijklnmopqrstuvwxyz") {
//handle mixed oid ex. .iso.2.3
s := strings.Split(oid, ".")
Expand Down

0 comments on commit bba6e38

Please sign in to comment.