← All posts
Automation

gRPC and gNMI Streaming Telemetry: Why SNMP Is Not Enough and How to Replace It

gRPC and gNMI Streaming Telemetry: Why SNMP Is Not Enough and How to Replace It

Why SNMP Is Not Good Enough for Modern Networks

SNMP was designed in the 1980s for a network that was much smaller and much slower. It works. But it has properties that make it painful at scale: polling-based (you pull data, the device does not push it), low cardinality (MIBs cover a fraction of modern device state), 32-bit counters that wrap in seconds on 100G interfaces, and a text-based ASN.1 encoding that is slow to parse.

Streaming telemetry flips the model. Instead of a manager polling every device on a schedule, the device streams data continuously as it changes. The manager receives a steady feed of structured data, processes it, and stores it. No polling storms. No missed events between poll intervals. And the data models cover things SNMP never did, like interface buffers, ECMP path utilization, BGP RIB details, and hardware resource utilization.

gRPC and Protocol Buffers

gRPC is a high-performance RPC framework from Google. It runs over HTTP/2, which gives it multiplexing (many streams over one connection), header compression, and binary framing. This is a big deal for telemetry: a single persistent TCP connection carries streaming data for all subscriptions from a device.

The payload encoding is Protocol Buffers (protobuf). Protobuf is a binary serialization format. The schema is defined in a .proto file, and both sides use generated code from that schema. Compared to JSON, protobuf is 3-10x more compact and 5-10x faster to parse. That matters when you're ingesting telemetry from 500 devices at 10-second intervals.

For network telemetry specifically, the gRPC framework carries gNMI (gRPC Network Management Interface) messages. gNMI defines the operations: Get (pull specific state), Set (configure), Subscribe (stream). It's the Subscribe operation you use for streaming telemetry.

gNMI: The Management Interface

gNMI defines a small set of RPCs that run over gRPC. The key ones for telemetry:

  • Capabilities: ask the device what models it supports and what version it's running. Use this first to understand what paths are available.

  • Get: pull the current value of one or more paths. Similar to SNMP Get but uses YANG paths. Good for one-shot state queries.

  • Set: push configuration. The gNMI equivalent of NETCONF edit-config.

  • Subscribe: open a streaming subscription. This is what streaming telemetry uses.

All gNMI operations use YANG-modeled paths to identify data. The path syntax is /interfaces/interface[name=eth0]/state/counters/in-octets. This path structure maps directly to OpenConfig or vendor YANG models. If you understand the YANG model, you know the paths.

Subscription Modes

gNMI Subscribe supports three modes:

STREAM with SAMPLE: the device sends a data snapshot every N seconds. This is the equivalent of periodic polling, except the device pushes instead of you pulling. Good for metrics with continuous changes (interface counters, CPU, memory).

STREAM with ON_CHANGE: the device sends an update only when the value changes. Ideal for state that is usually stable but changes are significant (BGP session state, interface operational status, route table changes). Very efficient, low overhead when things are stable.

ONCE: the device sends the current state once and closes the subscription. This is useful for one-shot audits or config verification without keeping a persistent stream open.

OpenConfig vs Vendor YANG Models

OpenConfig is a vendor-neutral YANG model maintained by an operator-led working group. When a device supports OpenConfig, you can use the same path on Cisco, Juniper, Arista, and Nokia gear and get structured data back in the same schema. This is the promise, and it mostly works for core networking constructs like interfaces, BGP, and routing tables.

Vendor YANG models extend beyond OpenConfig. They cover features that are vendor-specific, platform-specific hardware counters, internal state that OpenConfig does not define. Cisco NX-OS has DME (Data Model Engine) paths that expose internal state not in any OpenConfig model. Juniper's Junos models expose MPLS RSVP LSP details that OpenConfig does not cover.

In practice you use both. OpenConfig for portability and cross-vendor correlation. Vendor models for depth, especially for platform-specific monitoring like TCAM utilization, ASIC queue depths, and power consumption.

Tools: gnmic, Telegraf, and Grafana

The standard open-source stack for gNMI telemetry collection:

gnmic is a gNMI client CLI and collector. You can run gnmic subscribe --path /interfaces/interface/state/counters --mode stream --sample-interval 10s to see a live stream from a device in your terminal. It supports JSON, protobuf, and YANG-formatted output. It's the first tool to reach for when testing whether a device supports a specific path.

Telegraf with the gnmi input plugin is the common production collector. Telegraf connects to devices, runs subscriptions, and ships the data to InfluxDB, Prometheus, or Kafka. The config is straightforward: list the target devices, the paths you want, the encoding (protobuf), and the sample interval.

Grafana connected to InfluxDB or Prometheus is the visualization layer. Build dashboards showing interface utilization over time, BGP flap history, ECMP imbalance, whatever your paths surface. The data quality from gNMI is high enough that you can build alerting directly on the raw telemetry without needing a normalization layer.

Enabling gNMI on Cisco NX-OS

! Enable gRPC server
feature grpc ! Configure gRPC server
grpc port 57400 ! Verify
show grpc gnmi service statistics

gNMI uses port 57400 by default (some implementations use 50051). The service needs TLS in production. For lab use, many implementations support insecure mode.

Enabling gNMI on Cisco IOS-XR

grpc port 57400 no-tls ! lab only, remove for production address-family ipv4 telemetry model-driven destination-group dg1 address-family ipv4 192.168.1.100 port 57000 encoding self-describing-gpb protocol grpc no-tls sensor-group sg1 sensor-path Cisco-IOS-XR-infra-statsd-oper:infra-statistics/interfaces/interface/latest/generic-counters subscription sub1 sensor-group-id sg1 sample-interval 30000 destination-id dg1

Querying with gnmic

# Check what a device supports
gnmic -a 192.168.1.1:57400 --insecure capabilities # Get interface counters once
gnmic -a 192.168.1.1:57400 --insecure get \ --path /interfaces/interface/state/counters # Subscribe: stream interface counters every 10 seconds
gnmic -a 192.168.1.1:57400 --insecure subscribe \ --path /interfaces/interface/state/counters \ --mode stream \ --stream-mode sample \ --sample-interval 10s # On-change BGP session state
gnmic -a 192.168.1.1:57400 --insecure subscribe \ --path /network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/state \ --mode stream \ --stream-mode on-change

What to Monitor

Interface counters (in-octets, out-octets, in-errors, out-drops) are the starting point. Add BGP session state changes with ON_CHANGE subscriptions so you get instant notification of neighbor flaps. For AI fabrics, monitor ECMP load distribution across fabric links and queue depths on spine switches, since those are the first indicators of congestion before you see drops.

Correlating telemetry with application performance is where streaming really earns its keep. When a training job slows down, you can correlate the slowdown with specific interface congestion events at millisecond granularity, something 5-minute SNMP polling never gave you.

Watch on YouTube

gRPC and gNMI Streaming Telemetry: live demo with gnmic, Telegraf, and Grafana.

Watch Now

Comments (0)

Please sign in to comment.

  • Be the first to comment.