LinuxCommandLibrary

gnmic

Interact with network devices using gNMI

TLDR

Request device capabilities

$ gnmic [[-a|--address]] [ip:port] capabilities
copy

Provide a username and password to fetch device capabilities
$ gnmic [[-a|--address]] [ip:port] [[-u|--username]] [username] [[-p|--password]] [password] capabilities
copy

Get a snapshot of the device state at a specific path
$ gnmic [[-a|--address]] [ip:port] get --path [path]
copy

Update device state at a specific path
$ gnmic [[-a|--address]] [ip:port] set --update-path [path] --update-value [value]
copy

Subscribe to target state updates under the subtree at a specific path
$ gnmic [[-a|--address]] [ip:port] [[sub|subscribe]] --path [path]
copy

SYNOPSIS

gnmic [global-options] <subcommand> [<args>]

PARAMETERS

--address string
    Target gNMI server address (default: localhost:57400)

--config string
    Path to JSON/YAML config file

--encoding string
    Encoding format: json|proto|gnmi|jwt|bytes|ascii|json-ietf (default: json)

--insecure
    Disable TLS (use plain gRPC)

--password string
    Password for authentication

--skip-verify
    Skip TLS certificate verification

--system-ca
    Use system CA certificates for TLS

--target stringArray
    List of target addresses (overrides --address)

--timeout duration
    Request timeout (default: 10s)

--tls-cert string
    Path to TLS client certificate

--tls-key string
    Path to TLS client private key

--username string
    Username for authentication

--version
    Print version information

DESCRIPTION

gnmic is an open-source CLI client for the gNMI (gRPC Network Management Interface) protocol, designed for interacting with network devices that support telemetry and configuration management via gRPC.

It provides subcommands for common operations: capabilities to query device features, get to retrieve operational or configuration state, set to update configurations, subscribe for streaming telemetry data, monitor for ongoing subscriptions, and more like path-completion and action scripting.

Key features include support for multiple targets, various encodings (JSON, ProtoText, GNMI, etc.), username/password or TLS authentication, JSON config files, and output formatting options. gnmic is widely used in network automation, SDN environments, and DevOps workflows for SONiC, Junos, or IOS-XR devices.

Developed by the OpenConfig community, it emphasizes simplicity, extensibility via plugins, and production readiness with features like retry logic and delta encoding handling. Users can pipe inputs/outputs for scripting, making it ideal for CI/CD pipelines and monitoring tools.

CAVEATS

Requires devices supporting gNMI; not a standard distro package—install via Go or binaries. Subcommands have additional options; use gnmic <subcommand> --help for details.

INSTALLATION

Via Go: go install github.com/openconfig/gnmic/cmd/gnmic@latest
Binaries: Download from GitHub releases.

SUBCOMMANDS

Main: capabilities, get, set, subscribe, monitor, path-completion, action.

HISTORY

First released in 2020 by OpenConfig as a reference gNMI client. Actively maintained on GitHub with contributions from vendors like Nokia and Cisco. Major v0.2+ added multi-target support and plugins.

SEE ALSO

grpcurl(1)

Copied to clipboard