Issue on collecting telemetry data using Telegraf

660 views
Skip to first unread message

Yi Tse

unread,
Dec 14, 2021, 6:06:59 PM12/14/21
to sonicproject

Hi,

I am trying to collect telemetry data from the gnmi-server in the telemetry container using Telegraf.  I want to monitor the interface counters.  But I am getting the following errors from Telegraf:

telegraf    | 2021-12-14T22:52:27Z I! Starting Telegraf 1.20.4
telegraf    | 2021-12-14T22:52:27Z I! Using config file: /etc/telegraf/telegraf.conf
telegraf    | 2021-12-14T22:52:27Z I! Loaded inputs: gnmi
telegraf    | 2021-12-14T22:52:27Z I! Loaded aggregators:
telegraf    | 2021-12-14T22:52:27Z I! Loaded processors:
telegraf    | 2021-12-14T22:52:27Z I! Loaded outputs: influxdb_v2
telegraf    | 2021-12-14T22:52:27Z I! Tags enabled: host=d4bfed0db479
telegraf    | 2021-12-14T22:52:27Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"d4bfed0db479", Flush Interval:10s
telegraf    | 2021-12-14T22:52:27Z E! [inputs.gnmi] Error in plugin: failed to setup subscription: rpc error: code = Unavailable desc = connection closed before server preface received
telegraf    | 2021-12-14T22:52:37Z E! [inputs.gnmi] Error in plugin: failed to setup subscription: rpc error: code = Unavailable desc = connection closed before server preface received
telegraf    | 2021-12-14T22:52:47Z E! [inputs.gnmi] Error in plugin: failed to setup subscription: rpc error: code = Unavailable desc = connection closed before server preface received

The following is my gnmi input plugin config in Telegraf:

# gNMI telemetry input plugin

[[inputs.gnmi]]
 ## Address and port of the gNMI GRPC server
 addresses = ["10.194.89.84:8081"]

 ## define credentials
 username = "cisco"
 password = "cisco123"

 ## gNMI encoding requested (one of: "proto", "json", "json_ietf", "bytes")
 encoding = "proto"

 ## redial in case of failures after
 redial = "10s"

 ## enable client-side TLS and define CA to authenticate the device
 # enable_tls = true
 # tls_ca = "/etc/telegraf/ca.pem"
 # insecure_skip_verify = true

 ## define client-side TLS certificate & key to authenticate to the device
 # tls_cert = "/etc/telegraf/cert.pem"
 # tls_key = "/etc/telegraf/key.pem"

 ## gNMI subscription prefix (optional, can usually be left empty)
 ## See: https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md#222-paths
 # origin = ""
 # prefix = ""
 # target = ""

 ## Define additional aliases to map telemetry encoding paths to simple measurement names
 #[inputs.gnmi.aliases]
 #  ifcounters = "openconfig:/interfaces/interface/state/counters"

 [[inputs.gnmi.subscription]]
  ## Name of the measurement that will be emitted
  name = "ifcounters"

  ## Origin and path of the subscription
  ## See: https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md#222-paths
  ##
  ## origin usually refers to a (YANG) data model implemented by the device
  ## and path to a specific substructure inside it that should be subscribed to (similar to an XPath)
  ## YANG models can be found e.g. here: https://github.com/YangModels/yang/tree/master/vendor/cisco/xr
  origin = "openconfig-interfaces"
  path = "/interfaces/interface/state/counters"

  # Subscription mode (one of: "target_defined", "sample", "on_change") and interval
  subscription_mode = "sample"
  sample_interval = "10s"

  ## Suppress redundant transmissions when measured values are unchanged
  # suppress_redundant = false

  ## If suppression is enabled, send updates at least every X seconds anyway
  # heartbeat_interval = "60s"

What did I do wrong?  Thanks for any idea or help you can provide!

Yi Tong

Reply all
Reply to author
Forward
0 new messages