Linux command
gnmic-subscribe 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Subscribe to a path
gnmic -a [host:port] subscribe --path [/state/port]
Subscribe with sample interval
gnmic -a [host:port] subscribe --path [/state/port] --sample-interval [30s]
Subscribe with on-change mode
gnmic -a [host:port] subscribe --path [/state/port] --stream-mode on-change
Subscribe with heartbeat interval
gnmic -a [host:port] subscribe --path [/path] --stream-mode on-change --heartbeat-interval [1m]
Subscribe to multiple paths
gnmic -a [host:port] subscribe --path [/path1] --path [/path2]
Subscribe with authentication
gnmic -a [host:port] -u [user] -p [pass] subscribe --path [/path]
说明
gnmic subscribe sends a gNMI Subscribe RPC to network devices for streaming telemetry. It supports multiple subscription modes: ONCE (immediate single response), POLL (on-demand), and STREAM (continuous updates). Stream mode supports SAMPLE (periodic) and ON_CHANGE (event-driven) delivery. This is the full form of the gnmic sub command.
参数
- --path _path_
- gNMI path to subscribe to.
- --mode _mode_
- Subscription mode: STREAM, ONCE, POLL.
- --stream-mode _mode_
- Stream mode: SAMPLE, ON_CHANGE, TARGET_DEFINED.
- --sample-interval _duration_
- Sample interval for SAMPLE mode.
- --heartbeat-interval _duration_
- Heartbeat interval for ON_CHANGE mode.
- --suppress-redundant
- Suppress redundant updates.
- --updates-only
- Only send updates, not initial state.
- --quiet
- Do not output to stdout.
FAQ
What is the gnmic-subscribe command used for?
gnmic subscribe sends a gNMI Subscribe RPC to network devices for streaming telemetry. It supports multiple subscription modes: ONCE (immediate single response), POLL (on-demand), and STREAM (continuous updates). Stream mode supports SAMPLE (periodic) and ON_CHANGE (event-driven) delivery. This is the full form of the gnmic sub command.
How do I run a basic gnmic-subscribe example?
Run `gnmic -a [host:port] subscribe --path [/state/port]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --path _path_ do in gnmic-subscribe?
gNMI path to subscribe to.