From abb7eab5689dcb96dde83aa1c9f99889c1e707ee Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Fri, 13 Mar 2020 18:14:06 +0100 Subject: [PATCH 1/2] Add more platform support notes to GNMI --- plugins/inputs/cisco_telemetry_gnmi/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/inputs/cisco_telemetry_gnmi/README.md b/plugins/inputs/cisco_telemetry_gnmi/README.md index d70d66157409b..0b003fdefd218 100644 --- a/plugins/inputs/cisco_telemetry_gnmi/README.md +++ b/plugins/inputs/cisco_telemetry_gnmi/README.md @@ -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 From ecbc2a7ef1bf3488c910091320538c12b78b35e3 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Fri, 13 Mar 2020 18:37:20 +0100 Subject: [PATCH 2/2] Correctly convert GNMI DecimalVal to float64 number --- plugins/inputs/cisco_telemetry_gnmi/cisco_telemetry_gnmi.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/inputs/cisco_telemetry_gnmi/cisco_telemetry_gnmi.go b/plugins/inputs/cisco_telemetry_gnmi/cisco_telemetry_gnmi.go index c8c50e3686376..562c5effac4c6 100644 --- a/plugins/inputs/cisco_telemetry_gnmi/cisco_telemetry_gnmi.go +++ b/plugins/inputs/cisco_telemetry_gnmi/cisco_telemetry_gnmi.go @@ -7,6 +7,7 @@ import ( "encoding/json" "fmt" "io" + "math" "net" "path" "strings" @@ -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: