Unable to integrate Juniper Routers with gnmic
I have successfully integrated Nokia Routers with gnmic and successfully visualizing telemetry stats on Grafana. But with Juniper, i am unable to retrieve any data using get command, hence, it's not working using subscription as well. PFB for reference.
gnmic -a 10.1.1.1:57400 -u admin -p admin--insecure -d get --path /interfaces/interface/state/counters
2024/04/24 15:06:19.625745 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1 SubChannel #2] Subchannel created
2024/04/24 15:06:19.625790 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1] Channel Connectivity change to CONNECTING
2024/04/24 15:06:19.625867 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1] Channel exiting idle mode
2024/04/24 15:06:19.625967 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1 SubChannel #2] Subchannel Connectivity change to CONNECTING
2024/04/24 15:06:19.626077 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1 SubChannel #2] Subchannel picks a new address "10.1.1.1:57400" to connect
2024/04/24 15:06:19.626201 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [pick-first-lb 0xc0007c9e60] Received SubConn state update: 0xc00085c000, {ConnectivityState:CONNECTING ConnectionError:
When i used --encoding, same issue arise.
gnmic -a 10.1.1.1:57400 -u admin -p admin --encoding proto get --path /interfaces/interface/state/counters -d --insecure
2024/04/24 15:11:51.328128 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1 SubChannel #2] Subchannel created
2024/04/24 15:11:51.328235 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1] Channel Connectivity change to CONNECTING
2024/04/24 15:11:51.328364 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1] Channel exiting idle mode
2024/04/24 15:11:51.328484 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1 SubChannel #2] Subchannel Connectivity change to CONNECTING
2024/04/24 15:11:51.328583 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1 SubChannel #2] Subchannel picks a new address "10.1.1.1:57400" to connect
2024/04/24 15:11:51.328791 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [pick-first-lb 0xc0009b0150] Received SubConn state update: 0xc0009b02d0, {ConnectivityState:CONNECTING ConnectionError:
sudo systemctl status gnmic.service gnmic.service - gNMIc Service Loaded: loaded (/etc/systemd/system/gnmic.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2024-04-24 10:15:42 PKT; 4h 58min ago Main PID: 2158922 (gnmic) Tasks: 15 (limit: 9428) Memory: 34.6M CPU: 35min 48.328s CGroup: /system.slice/gnmic.service 2158922 /usr/local/bin/gnmic --debug --config /home/gnmi/gnmic.yml subscribe
gnmic.yml:
port: 57400 timeout: 10s insecure: true
targets: 192.168.69.38: username: admin password: admin subscriptions: - sros_port_stats - sros_ce_port_stats - sros_cpu - sros_memory_pool - sros_bgp_state - sros_ospf_state - sros_interface_state - sros_oper_state
10.1.1.1: username: admin password: admin subscriptions: - junos_interface_stats
subscriptions: sros_cpu: paths: - "/state/system/cpu[sample-period=60]/summary/usage" mode: stream stream-mode: sample sample-interval: 5s
sros_memory_pool: paths: - "/state/system/memory-pools" mode: stream stream-mode: sample sample-interval: 5s
sros_port_stats: paths: - "/state/port[port-id=esat-1/1/1]/statistics" mode: stream stream-mode: sample sample-interval: 5s
sros_ce_port_stats: paths: - "/state/port[port-id=1/1/c1/1]/statistics" mode: stream stream-mode: sample sample-interval: 5s
sros_bgp_state: paths: - "/state/router/bgp/neighbor/statistics/session-state" mode: stream stream-mode: sample sample-interval: 1s
sros_ospf_state: paths: - "/state/router/ospf/area/interface/neighbor-state/oper-state" mode: stream stream-mode: sample sample-interval: 1s
junos_interface_stats: paths: - "/interfaces/interface/state/counters/in-octets" - "/interfaces/interface/state/counters/out-octets" mode: stream stream-mode: sample sample-interval: 5s
outputs: prom: type: prometheus listen: :9273 path: /metrics metric-prefix: gnmic append-subscription-name: true export-timestamps: true debug: false
gnmic version version : 0.35.1 commit : 91f4205 date : 2024-01-25T21:10:47Z gitURL : https://github.com/openconfig/gnmic docs : https://gnmic.openconfig.net
You are missing the --encoding flag. you can either pass it as a flag or part of the config file.
As I mentioned earlier, when I passed --encoding as flag with get, it still showed same error.
can you show an example of how you did that ?
PFB.
gnmic -a 10.1.1.1:57400 -u admin -p admin --encoding proto get --path /interfaces/interface/state/counters -d --insecure
2024/04/25 10:37:42.599834 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1 SubChannel #2] Subchannel created
2024/04/25 10:37:42.599884 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1] Channel Connectivity change to CONNECTING
2024/04/25 10:37:42.599961 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1] Channel exiting idle mode
2024/04/25 10:37:42.600025 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1 SubChannel #2] Subchannel Connectivity change to CONNECTING
2024/04/25 10:37:42.600072 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1 SubChannel #2] Subchannel picks a new address "10.1.1.1:57400" to connect
2024/04/25 10:37:42.600225 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [pick-first-lb 0xc000ad28a0] Received SubConn state update: 0xc000ad2a20, {ConnectivityState:CONNECTING ConnectionError:
you should check with Juniper which encodings are supported
Afair Juniper didn't play well with get requests; users were forced to use subscribe rpc
So, if i use encoding in config file, will it impact Nokia Routers as well because it is visualizing successfully for Nokia Routers.
you can set the encoding per subscription: https://gnmic.openconfig.net/user_guide/subscriptions/#file-based-subscription-config
Yes, get doesn't work with Juniper. I used encoding in config file and it start scrapping data to Prometheus.
subscriptions: junos_interface_stats: paths: - "/interfaces/interface[name=et-1/1/0]/state/counters" mode: stream stream-mode: TARGET_DEFINED sample-interval: 5s encoding: proto
Thanks.