gnmic icon indicating copy to clipboard operation
gnmic copied to clipboard

Unable to integrate Juniper Routers with gnmic

Open arbabali999 opened this issue 1 year ago • 8 comments

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:} 2024/04/24 15:06:19.629830 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1 SubChannel #2] Subchannel Connectivity change to READY 2024/04/24 15:06:19.629957 /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:READY ConnectionError:} 2024/04/24 15:06:19.630026 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1] Channel Connectivity change to READY 2024/04/24 15:06:20.066320 /home/runner/work/gnmic/gnmic/pkg/app/logging.go:21: [gnmic] target "10.1.1.1:57400" get request failed: "10.1.1.1:57400" GetRequest failed: rpc error: code = Unimplemented desc = Encoding not supported 2024/04/24 15:06:20.066420 /home/runner/work/gnmic/gnmic/pkg/app/logging.go:21: [gnmic] target "10.1.1.1:57400" Get request failed: "10.1.1.1:57400" GetRequest failed: rpc error: code = Unimplemented desc = Encoding not supported target "10.1.1.1:57400" get request failed: "10.1.1.1:57400" GetRequest failed: rpc error: code = Unimplemented desc = Encoding not supported target "10.1.1.1:57400" Get request failed: "10.1.1.1:57400" GetRequest failed: rpc error: code = Unimplemented desc = Encoding not supported

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:} 2024/04/24 15:11:51.331169 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1 SubChannel #2] Subchannel Connectivity change to READY 2024/04/24 15:11:51.331325 /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:READY ConnectionError:} 2024/04/24 15:11:51.331429 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1] Channel Connectivity change to READY 2024/04/24 15:11:52.063025 /home/runner/work/gnmic/gnmic/pkg/app/logging.go:21: [gnmic] target "10.1.1.1:57400" get request failed: "10.1.1.1:57400" GetRequest failed: rpc error: code = Unimplemented desc = Encoding not supported 2024/04/24 15:11:52.063115 /home/runner/work/gnmic/gnmic/pkg/app/logging.go:21: [gnmic] target "10.1.1.1:57400" Get request failed: "10.1.1.1:57400" GetRequest failed: rpc error: code = Unimplemented desc = Encoding not supported target "10.1.1.1:57400" get request failed: "10.1.1.1:57400" GetRequest failed: rpc error: code = Unimplemented desc = Encoding not supported target "10.1.1.1:57400" Get request failed: "10.1.1.1:57400" GetRequest failed: rpc error: code = Unimplemented desc = Encoding not supported

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

arbabali999 avatar Apr 24 '24 10:04 arbabali999

You are missing the --encoding flag. you can either pass it as a flag or part of the config file.

karimra avatar Apr 24 '24 23:04 karimra

As I mentioned earlier, when I passed --encoding as flag with get, it still showed same error.

arbabali999 avatar Apr 25 '24 05:04 arbabali999

can you show an example of how you did that ?

karimra avatar Apr 25 '24 05:04 karimra

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:} 2024/04/25 10:37:42.602102 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1 SubChannel #2] Subchannel Connectivity change to READY 2024/04/25 10:37:42.602199 /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:READY ConnectionError:} 2024/04/25 10:37:42.602256 /home/runner/go/pkg/mod/google.golang.org/[email protected]/grpclog/logger.go:53: [gnmic] [core] [Channel #1] Channel Connectivity change to READY 2024/04/25 10:37:43.425883 /home/runner/work/gnmic/gnmic/pkg/app/logging.go:21: [gnmic] target "10.1.1.1:57400" get request failed: "10.1.1.1:57400" GetRequest failed: rpc error: code = Unimplemented desc = Encoding not supported 2024/04/25 10:37:43.425972 /home/runner/work/gnmic/gnmic/pkg/app/logging.go:21: [gnmic] target "10.1.1.1:57400" Get request failed: "10.1.1.1:57400" GetRequest failed: rpc error: code = Unimplemented desc = Encoding not supported target "10.1.1.1:57400" get request failed: "10.1.1.1:57400" GetRequest failed: rpc error: code = Unimplemented desc = Encoding not supported target "10.1.1.1:57400" Get request failed: "10.1.1.1:57400" GetRequest failed: rpc error: code = Unimplemented desc = Encoding not supported Error: one or more requests failed

arbabali999 avatar Apr 25 '24 05:04 arbabali999

you should check with Juniper which encodings are supported

karimra avatar Apr 25 '24 06:04 karimra

Afair Juniper didn't play well with get requests; users were forced to use subscribe rpc

hellt avatar Apr 25 '24 06:04 hellt

So, if i use encoding in config file, will it impact Nokia Routers as well because it is visualizing successfully for Nokia Routers.

arbabali999 avatar Apr 25 '24 08:04 arbabali999

you can set the encoding per subscription: https://gnmic.openconfig.net/user_guide/subscriptions/#file-based-subscription-config

karimra avatar Apr 25 '24 15:04 karimra

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.

arbabali999 avatar Apr 30 '24 11:04 arbabali999