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] subscribe --path [path]
copy

SYNOPSIS

gnmic [global-options] command [command-options] [arguments]

Common Commands:
  capabilities  Discover device capabilities and supported models.
  get          Retrieve configuration and state from a device.
  set           Modify configuration on a device.
  subscribe     Subscribe to telemetry streams from a device.
  diff          Compare configurations or states.
  generate      Generate gNMI paths or configuration payloads.
  register      Register for event notifications.

PARAMETERS

--address, -a <addr>
    Specifies the gNMI target address(es) to connect to (e.g., localhost:50051).

--username, -u <user>
    Provides the username for gNMI authentication.

--password, -p <pass>
    Provides the password for gNMI authentication.

--insecure
    Disables TLS certificate verification, allowing connections to servers with untrusted certificates.

--tls-ca <path>
    Path to the CA certificate file for TLS authentication.

--encoding <type>
    Sets the gNMI encoding type for data (e.g., JSON, PROTO, JSON_IETF).

--format <fmt>
    Defines the output format for responses (e.g., JSON, YAML, TEXT, PROTO).

--debug
    Enables verbose debug logging output for troubleshooting.

--config <file>
    Specifies a path to a gnmic configuration file (typically gnmic.yaml).

DESCRIPTION

gnmic is a powerful, open-source CLI client for the gRPC Network Management Interface (gNMI) protocol. It enables network operators and engineers to interact with network devices that support gNMI, offering a modern alternative to traditional protocols like SNMP and NETCONF.

With gnmic, users can perform various operations such as subscribing to telemetry data, retrieving configuration and operational state, setting configuration, and discovering device capabilities. Its design emphasizes flexibility and scriptability, supporting multiple output formats like JSON, YAML, and text, making it highly suitable for integration into automation workflows. gnmic simplifies network automation by providing a unified, high-performance way to manage heterogeneous network infrastructure using a standardized protocol. It supports essential features including TLS, authentication, and all gNMI RPCs (Capabilities, Get, Set, Subscribe, Diff), making it an indispensable tool for modern network operations and programmability.

CAVEATS

  • Requires network devices to support and be configured for gNMI.
  • Correct TLS setup (certificates, CA) can be complex for secure deployments.
  • Understanding gNMI paths and models (e.g., OpenConfig) is crucial for effective use.
  • SUPPORTED RPCS

    gnmic fully supports all core gNMI RPCs: Capabilities (to discover device features), Get (for one-time data retrieval), Set (for configuration changes), and Subscribe (for continuous telemetry streams).

    CONFIGURATION FILES

    gnmic can be configured using a YAML file (defaulting to ~/.gnmic.yaml or gnmic.yaml in the current directory). This allows users to define target connections, TLS settings, default encodings, and more, avoiding repetitive command-line arguments.

    HISTORY

    The gnmic CLI client was developed by members of the OpenConfig community, notably by SNC, as a modern, high-performance tool to interact with network devices using the gRPC Network Management Interface (gNMI) protocol. It emerged to address the limitations of traditional network management protocols like SNMP and NETCONF, offering a streaming-capable, RPC-based alternative. Its development focused on providing a robust, flexible, and automation-friendly interface, quickly gaining traction within the network automation and programmable networking communities. It is now widely used across various network operating systems and vendor platforms supporting gNMI.

    SEE ALSO

    snmpget(1): A traditional CLI for SNMP network management., netconf-console(1): A CLI for NETCONF protocol interactions., grpc(7): General information about the gRPC framework used by gNMI.

    Copied to clipboard