Skip to content

Commit

Permalink
Add support for GNMI DecimalVal type (#7173)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbyx authored Mar 17, 2020
1 parent 9d7f560 commit 064247a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions plugins/inputs/cisco_telemetry_gnmi/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Cisco GNMI Telemetry

Cisco GNMI Telemetry is an input plugin that consumes telemetry data similar to the [GNMI specification](https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md).
This GRPC-based protocol can utilize TLS for authentication and encryption.
Cisco GNMI Telemetry is an input plugin that consumes telemetry data based on the [GNMI](https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md) Subscribe method. TLS is supported for authentication and encryption.

This plugin has been developed to support GNMI telemetry as produced by Cisco IOS XR (64-bit) version 6.5.1 and later.
It has been optimized to support GNMI telemetry as produced by Cisco IOS XR (64-bit) version 6.5.1, Cisco NX-OS 9.3 and Cisco IOS XE 16.12 and later.


### Configuration
Expand Down
3 changes: 2 additions & 1 deletion plugins/inputs/cisco_telemetry_gnmi/cisco_telemetry_gnmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/json"
"fmt"
"io"
"math"
"net"
"path"
"strings"
Expand Down Expand Up @@ -332,7 +333,7 @@ func (c *CiscoTelemetryGNMI) handleTelemetryField(update *gnmi.Update, tags map[
case *gnmi.TypedValue_BytesVal:
value = val.BytesVal
case *gnmi.TypedValue_DecimalVal:
value = val.DecimalVal
value = float64(val.DecimalVal.Digits) / math.Pow(10, float64(val.DecimalVal.Precision))
case *gnmi.TypedValue_FloatVal:
value = val.FloatVal
case *gnmi.TypedValue_IntVal:
Expand Down

0 comments on commit 064247a

Please sign in to comment.