gnmic-subscribe
Subscribe to network device telemetry data
TLDR
Subscribe to target state updates under the subtree of a specific path
Subscribe to a target with a sample interval of 30s (default is 10s)
Subscribe to a target with sample interval and updates only on change
Subscribe to a target for only one update
Subscribe to a target and specify response encoding (json_ietf)
SYNOPSIS
gnmic-subscribe [global-options] [subscribe-options] [paths...]
PARAMETERS
-a, --address
gNMI target address (host:port). Required.
-u, --username
Username for authentication.
-p, --password
Password for authentication.
--insecure
Skip TLS certificate validation.
--timeout
gRPC timeout. Default: 10s.
--encoding
Subscription encoding: proto,json,json-ietf,bytes,gob. Default: json-ietf.
--format
Output format: proto,json,json-ietf,bytes,gob,proto3. Default: json.
--mode
Subscription mode: stream,sample,onchange. Default: stream.
--sample-interval
Sample interval in seconds for sample mode.
--heartbeat-interval
Heartbeat interval in seconds.
--suppress-redundant
Skip redundant updates.
--prefix-paths
Subscribe using path prefixes.
--path-prefix
Global path prefix for all subscriptions.
--stream-updates-only
Print only stream messages, skip sync.
--one-off
Perform one-off subscription and exit.
--updates-only
Skip initial sync, print only updates.
-f, --file
Read paths from file.
--tls-ca
CA certificate file.
--tls-cert
Client certificate file.
--tls-key
Client key file.
DESCRIPTION
gnmic-subscribe is a command-line tool for subscribing to streaming telemetry from network devices via the gNMI (gRPC Network Management Interface) protocol. It polls or streams YANG-modeled operational data like interface stats, BGP peers, and system metrics in real-time. Specify target addresses, gnmic-paths (e.g., /interfaces/interface[name=Ethernet1]/state/counters), modes (stream, sample, onchange), and output formats (JSON, Proto, etc.). Supports authentication (basic, TLS), reconnections, heartbeats, and data suppression for efficiency.
Ideal for monitoring pipelines, it prefixes paths, handles incremental updates, and exports to files or stdout for processing with tools like Kafka or Prometheus. Prefix modes enable hierarchical subscriptions across namespaces. Widely used in data center and service provider networks for scalable telemetry.
CAVEATS
Requires gNMI-capable targets. Paths must use valid gnmic-path syntax. High-volume streams may overload stdout; pipe to files/processors. TLS required for secure connections.
PATH SYNTAX
Format: [origin:]name[/name][{key=value,key2=value2}][|json-pointer]. Supports escapes and wildcards.
MODES
stream: Continuous updates.
sample: Periodic polls.
onchange: Delta changes only.
HISTORY
Introduced in gnmic v0.1.0 (2020) by OpenConfig community. Evolved from gNMI c/c++ clients; now Golang-based with active GitHub development (v0.2.x+). Supports gNMI 1.1 spec.


