Fix inputs.snmp init when no mibs installed (#9050)
This commit is contained in:
parent
9c54c8e233
commit
66c639668c
|
|
@ -255,6 +255,8 @@ func (f *Field) init() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if oid needs translation or name is not set
|
||||||
|
if strings.ContainsAny(f.Oid, ":abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") || f.Name == "" {
|
||||||
_, oidNum, oidText, conversion, err := SnmpTranslate(f.Oid)
|
_, oidNum, oidText, conversion, err := SnmpTranslate(f.Oid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("translating: %w", err)
|
return fmt.Errorf("translating: %w", err)
|
||||||
|
|
@ -266,8 +268,8 @@ func (f *Field) init() error {
|
||||||
if f.Conversion == "" {
|
if f.Conversion == "" {
|
||||||
f.Conversion = conversion
|
f.Conversion = conversion
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO use textual convention conversion from the MIB
|
//TODO use textual convention conversion from the MIB
|
||||||
|
}
|
||||||
|
|
||||||
f.initialized = true
|
f.initialized = true
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue