parent
9feb639bbd
commit
b48ad4b737
|
@ -44,6 +44,7 @@
|
||||||
- [#1702](https://github.com/influxdata/telegraf/issues/1702): sqlserver, fix issue when case sensitive collation is activated.
|
- [#1702](https://github.com/influxdata/telegraf/issues/1702): sqlserver, fix issue when case sensitive collation is activated.
|
||||||
- [#1823](https://github.com/influxdata/telegraf/issues/1823): Fix huge allocations in http_listener when dealing with huge payloads.
|
- [#1823](https://github.com/influxdata/telegraf/issues/1823): Fix huge allocations in http_listener when dealing with huge payloads.
|
||||||
- [#1833](https://github.com/influxdata/telegraf/issues/1833): Fix translating SNMP fields not in MIB.
|
- [#1833](https://github.com/influxdata/telegraf/issues/1833): Fix translating SNMP fields not in MIB.
|
||||||
|
- [#1835](https://github.com/influxdata/telegraf/issues/1835): Fix SNMP emitting empty fields.
|
||||||
|
|
||||||
## v1.0.1 [unreleased]
|
## v1.0.1 [unreleased]
|
||||||
|
|
||||||
|
|
|
@ -460,14 +460,16 @@ func (t Table) Build(gs snmpConnection, walk bool) (*RTable, error) {
|
||||||
// index, and being added on the same row.
|
// index, and being added on the same row.
|
||||||
if pkt, err := gs.Get([]string{oid}); err != nil {
|
if pkt, err := gs.Get([]string{oid}); err != nil {
|
||||||
return nil, Errorf(err, "performing get")
|
return nil, Errorf(err, "performing get")
|
||||||
} else if pkt != nil && len(pkt.Variables) > 0 && pkt.Variables[0].Type != gosnmp.NoSuchObject {
|
} else if pkt != nil && len(pkt.Variables) > 0 && pkt.Variables[0].Type != gosnmp.NoSuchObject && pkt.Variables[0].Type != gosnmp.NoSuchInstance {
|
||||||
ent := pkt.Variables[0]
|
ent := pkt.Variables[0]
|
||||||
fv, err := fieldConvert(f.Conversion, ent.Value)
|
fv, err := fieldConvert(f.Conversion, ent.Value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, Errorf(err, "converting %q", ent.Value)
|
return nil, Errorf(err, "converting %q", ent.Value)
|
||||||
}
|
}
|
||||||
|
if fvs, ok := fv.(string); !ok || fvs != "" {
|
||||||
ifv[""] = fv
|
ifv[""] = fv
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
err := gs.Walk(oid, func(ent gosnmp.SnmpPDU) error {
|
err := gs.Walk(oid, func(ent gosnmp.SnmpPDU) error {
|
||||||
if len(ent.Name) <= len(oid) || ent.Name[:len(oid)+1] != oid+"." {
|
if len(ent.Name) <= len(oid) || ent.Name[:len(oid)+1] != oid+"." {
|
||||||
|
@ -487,7 +489,9 @@ func (t Table) Build(gs snmpConnection, walk bool) (*RTable, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Errorf(err, "converting %q", ent.Value)
|
return Errorf(err, "converting %q", ent.Value)
|
||||||
}
|
}
|
||||||
|
if fvs, ok := fv.(string); !ok || fvs != "" {
|
||||||
ifv[idx] = fv
|
ifv[idx] = fv
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -62,12 +62,15 @@ var tsc = &testSNMPConnection{
|
||||||
values: map[string]interface{}{
|
values: map[string]interface{}{
|
||||||
".1.0.0.0.1.1.0": "foo",
|
".1.0.0.0.1.1.0": "foo",
|
||||||
".1.0.0.0.1.1.1": []byte("bar"),
|
".1.0.0.0.1.1.1": []byte("bar"),
|
||||||
|
".1.0.0.0.1.1.2": []byte(""),
|
||||||
".1.0.0.0.1.102": "bad",
|
".1.0.0.0.1.102": "bad",
|
||||||
".1.0.0.0.1.2.0": 1,
|
".1.0.0.0.1.2.0": 1,
|
||||||
".1.0.0.0.1.2.1": 2,
|
".1.0.0.0.1.2.1": 2,
|
||||||
|
".1.0.0.0.1.2.2": 0,
|
||||||
".1.0.0.0.1.3.0": "0.123",
|
".1.0.0.0.1.3.0": "0.123",
|
||||||
".1.0.0.0.1.3.1": "0.456",
|
".1.0.0.0.1.3.1": "0.456",
|
||||||
".1.0.0.0.1.3.2": "9.999",
|
".1.0.0.0.1.3.2": "0.000",
|
||||||
|
".1.0.0.0.1.3.3": "9.999",
|
||||||
".1.0.0.0.1.4.0": 123456,
|
".1.0.0.0.1.4.0": 123456,
|
||||||
".1.0.0.1.1": "baz",
|
".1.0.0.1.1": "baz",
|
||||||
".1.0.0.1.2": 234,
|
".1.0.0.1.2": 234,
|
||||||
|
@ -426,6 +429,14 @@ func TestTableBuild_noWalk(t *testing.T) {
|
||||||
Oid: ".1.0.0.1.2",
|
Oid: ".1.0.0.1.2",
|
||||||
IsTag: true,
|
IsTag: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "empty",
|
||||||
|
Oid: ".1.0.0.0.1.1.2",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "noexist",
|
||||||
|
Oid: ".1.2.3.4.5",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue