Skip to content

Commit

Permalink
fix(inputs.gnmi): Do not provide empty prefix for subscription reques…
Browse files Browse the repository at this point in the history
…t. (#12275)
  • Loading branch information
srebhan authored Nov 28, 2022
1 parent c6dbc3f commit 54f4a3a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/inputs/gnmi/gnmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@ func (c *GNMI) newSubscribeRequest() (*gnmiLib.SubscribeRequest, error) {
return nil, err
}

// Do not provide an empty prefix. Required for Huawei NE40 router v8.21
// (and possibly others). See https://github.com/influxdata/telegraf/issues/12273.
if gnmiPath.Origin == "" && gnmiPath.Target == "" && len(gnmiPath.Elem) == 0 {
gnmiPath = nil
}

if c.Encoding != "proto" && c.Encoding != "json" && c.Encoding != "json_ietf" && c.Encoding != "bytes" {
return nil, fmt.Errorf("unsupported encoding %s", c.Encoding)
}
Expand Down

0 comments on commit 54f4a3a

Please sign in to comment.