/home/runner/work/gnmic/gnmic/pkg/loaders/file_loader/file_loader.go:201: [file_loader] failed to read targets file
Hi , I am using gnmi file loader to load remote file and i get the error
/home/runner/work/gnmic/gnmic/pkg/loaders/file_loader/file_loader.go:201: [file_loader] failed to read targets file: Get "https://
hwever i am able to get the content of the file using curl
That error means the request timed out. There could be many reasons for that.
- Check that the http server is reachable from gnmic server/container/pod.
- Check if the http server you run has tls enabled or not and configure the loader accordingly.
@karimra
- Check that the http server is reachable from gnmic server/container/pod. ->for this i added http_proxy in gnmi env variable,
but how will i check from the gnmic server/container/pod ? curl is not available and even i am unable to do apk add curl there 2. Check if the http server you run has tls enabled or not and configure the loader accordingly. -> since from test pods i am able to curl and i get the file content without passing tls and without using -k . I feel the way I am passing the token is not correct. Internally gnmi is doing url.Parse(path) . When i do the parse seperately i get the error panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]: main.main() /tmp/sandbox2191370610/prog.go:31 +0x4a5
It seems we can not pass ?token=token value in the url
If your http server does not have TLS enabled try with a url with scheme http:// not https://
No , we need to use https only, but i already set the skip-verify: true @karimra how to troubleshoot this? when i try to install curl in pod(using apk add curl) to test the connecitivity to the file i get ERROR: Unable to lock database: Permission denied ERROR: Failed to open apk database: Permission denied
can you share your loader config here, so we are on the same page?
insecure: true
loader:
type: file
path: https://<gitlab.com>/api/v4/projects/222/repository/files/test%2ftargets.yaml/raw?private_token=23122432424
interval: 30s
maybe replace that %2f with /, the url parsing will do that for you.
@karimra url parsing works fine for the url https://<gitlab.com>/api/v4/projects/222/repository/files/test%2ftargets.yaml/raw?private_token=23122432424 but how can i test from gnmi this url is accessible?
That depends on your setup, that's out of scope of gnmic.
@karimra I am able to do the curl
On the node that you are running your gnmic pod you can run curl on the node but in network namespace of the gnmic pod which should tell you if you have some type of issue due to name resolution and/or pod network policy etc.
https://www.redhat.com/sysadmin/container-namespaces-nsenter
Also if the URL works with gnmic outside the pod then the issue is not with gnmic but with your environment ...
@peejaychilds @karimra Can gnmi file loader is able to fetch the file from gilab?
From the node where gnmi pods are runing, able to curl