gNMIc Collector
gNMIc is the telemetry collector that subscribes to gNMI streams from Nokia devices and exports metrics to Prometheus.Overview
gNMIc (gRPC Network Management Interface client) is an open-source tool from OpenConfig that:- Establishes gRPC connections to network devices
- Subscribes to telemetry data using gNMI protocol
- Processes and transforms streaming data
- Exports metrics in multiple formats (Prometheus, InfluxDB, Kafka, etc.)
- Container: gnmic
- Management IP: 10.77.1.12
- Metrics Port: 9273
- Config File:
configs/gnmic/config.yml
Configuration File Structure
The gNMIc configuration consists of four main sections:Auto-Discovery with Docker Loader
The lab uses Docker auto-discovery to automatically find and configure Nokia devices:The loader automatically discovers all Containerlab nodes labeled with
clab-node-kind=nokia_srlinux or clab-node-kind=nokia_srsim and applies the appropriate configuration.Key Loader Parameters
| Parameter | Description |
|---|---|
type: docker | Use Docker container discovery |
address | Docker socket path |
filters | Container selection criteria |
label | Match containers by label |
port | gNMI port (57400 for Nokia) |
encoding | proto for SR Linux, json for SROS |
Telemetry Subscriptions
Subscriptions define what data to collect and how frequently.SROS Subscriptions
- Port Statistics
- System Metrics
- BNG Sessions
- Routing Protocols
SR Linux Subscriptions
- Platform Metrics
- Interface Stats
- BGP Statistics
Subscription Parameters
| Parameter | Description | Example |
|---|---|---|
paths | YANG paths to subscribe to | /state/port/statistics/ |
mode | Subscription mode | stream |
stream-mode | How data is sent | sample (periodic) or on-change |
sample-interval | Polling frequency | 5s (5 seconds) |
Stream modes:
sample: Send updates at regular intervals (5s in this lab)on-change: Send updates only when values change (not used in this lab)
Data Processing Pipeline
gNMIc applies processors to transform telemetry data before exporting:1. Trim SROS Prefixes
/state prefix from metric names:
/state/port/statistics/in-packets→/port/statistics/in-packets
2. Extract Labels
- Path:
/router/route-table/unicast/ipv4/statistics/bgp/active-routes - Labels:
{family="ipv4", protocol="bgp"}
3. Convert State Values
up→ 1down→ 0
4. Group by Interface
Prometheus Export
The final step exports processed metrics in Prometheus format:Export Parameters
| Parameter | Value | Description |
|---|---|---|
listen | :9273 | Port for Prometheus scraping |
path | /metrics | HTTP endpoint path |
export-timestamps | true | Include metric timestamps |
strings-as-labels | true | Convert string values to labels |
event-processors | (list) | Processing pipeline order |
Example Metrics Output
Verify gNMIc Operation
Check Container Status
View gNMIc Logs
Test Metrics Endpoint
Check Active Subscriptions
Troubleshooting gNMI Connections
Connection refused errors
Connection refused errors
Problem:
connection refused or context deadline exceededSolutions:- Verify device is running:
sudo docker ps | grep bng1 - Check gNMI port is open:
- Confirm credentials are correct in
config.yml - Check device gNMI is enabled (should be by default)
Authentication failures
Authentication failures
Problem:
rpc error: code = UnauthenticatedSolutions:- Verify credentials in loader config:
- Check device admin password hasn’t changed
- Try connecting manually:
No metrics exported
No metrics exported
Problem:
/metrics endpoint returns empty or no dataSolutions:- Check subscriptions are active in logs
- Verify devices are sending data:
- Test a specific subscription:
- Check processor configuration isn’t filtering all data
High CPU usage
High CPU usage
Problem: gNMIc container consuming excessive CPUSolutions:
- Reduce subscription frequency:
- Limit subscription paths to essential metrics only
- Disable debug logging:
Custom Subscription Examples
Add New SROS Subscription
Monitor Specific Interfaces Only
Increase Sampling Frequency
Configuration Best Practices
Performance Tips:
- Keep
sample-intervalat 5s or higher to avoid overwhelming devices - Use specific paths instead of wildcards when possible
- Limit subscriptions to metrics you actually need
- Use processors to reduce cardinality (unique label combinations)
- Monitor gNMIc CPU and memory usage
Next Steps
Prometheus Setup
Configure Prometheus to scrape gNMIc metrics
Available Metrics
Browse the complete metrics catalog