openconfig / gnmic

gNMIc is a gNMI CLI client and collector
https://gnmic.openconfig.net
Apache License 2.0
168 stars 54 forks source link

Unable to integrate Juniper Routers with gnmic #418

Closed arbabali999 closed 3 months ago

arbabali999 commented 4 months ago

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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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:

subscriptions: sros_cpu: paths:

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

karimra commented 4 months ago

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

arbabali999 commented 4 months ago

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

karimra commented 4 months ago

can you show an example of how you did that ?

arbabali999 commented 4 months ago

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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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/grpc@v1.60.1/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

karimra commented 4 months ago

you should check with Juniper which encodings are supported

hellt commented 4 months ago

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

arbabali999 commented 4 months ago

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

karimra commented 4 months ago

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

arbabali999 commented 3 months ago

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:

Thanks.