gnmic-get
Retrieve data from network devices using gNMI
TLDR
Get a snapshot of the device state at a specific path
Query the device state at multiple paths
Query the device state at multiple paths with a common prefix
Query the device state and specify response encoding (json_ietf)
SYNOPSIS
gnmic-get [OPTIONS] [PATHS...]
or
gnmic get [OPTIONS] [PATHS...]
PARAMETERS
-a, --address <host:port>
gNMI target address. Default: localhost:57400
-u, --username <string>
Username for authentication
-p, --password <string>
Password for authentication (use env GNMIC_PASSWORD)
--insecure
Skip TLS certificate validation
--timeout <duration>
gRPC timeout. Default: 10s
--encoding <proto|json|json-ietf>
Encoding for paths. Default: json-ietf
--format <proto|json|json-ietf|...>
Output format. Default: json
--target <string>
Logical target name on the server
--prefix <path>
Common path prefix for all requests
--action <get|get-config>
Get action. Default: get
--model <string[]>
YANG models to request data from
--suppress-prefix
Omit prefix from response paths
--config <file>
TOML config file path
--print-request
Print gNMI request before sending
-h, --help
Show help
--version
Print version information
DESCRIPTION
gnmic-get is a command-line utility from the gnmic suite, designed to query and retrieve specific data paths from network devices supporting the gNMI (gRPC Network Management Interface) protocol.
It enables users to fetch operational state, configuration snapshots, or YANG-modeled telemetry data from targets like routers and switches. The tool establishes a secure gRPC connection, optionally authenticates, and requests values using XPath-like paths. Responses can be formatted in JSON, Protobuf text, or other encodings for easy integration into scripts, monitoring systems, or manual inspection.
Ideal for network automation, validation, and telemetry in SDN environments, gnmic-get supports actions like get (operational data) and get-config (configuration data), with options for prefixes, models, and TLS. It reads from config files or CLI flags, making it flexible for both interactive and batch use.
CAVEATS
Requires gNMI server on target; paths must match device's YANG models. TLS recommended for production. Large responses may timeout.
EXAMPLES
Basic get: gnmic-get -a device.example.com:57400 /interfaces/interface[name=eth0]/state/counters
With config: gnmic-get --action get-config -a 192.168.1.1:57400 /system/config
JSON output: gnmic-get --format json-ietf /network-instances/name=default/protocols/protocol/openconfig-policy-forwarding:BGP
CONFIGURATION FILE
Uses TOML format. Example:[gnmi-client]
address = "localhost:57400"
username = "admin"
password = "pass"
Invoke with --config gnmic.conf
HISTORY
Part of gnmic project started by CloudRouter in 2020, evolved from OpenConfig efforts. Now maintained by Mirantis; v0.1.0 in 2020, latest v0.15+ with enhanced JSON support.
SEE ALSO
gnmic-set(1), gnmic-subscribe(1), gnmic-capabilities(1), grpcurl(1)


