I am trying to call a PRTG API with built in authentication in the URL using the JSON Data Source. I have added the new Data Source with the correct URL and authentication, through the settings. When trying to run a query on the URL, i get this error: Error running query: Can’t query private addresses.
I tried to follow the JSON & URL guide, but i keep getting that error. It also happens when i add the url: https://xxx.xx:someport/jsonApi
Can i setup this in another way or change how i call the URL? When i enter the URL in my browser i get all the data from PRTG as a JSON response.
I tried changing the URL to this: https%3A%2F%2Fxxx.xx:someport/jsonApi - then i get this error: Error running query: gethostbyname() argument 1 must be string, not None I guess that only worked for the old URL Data Source?
Gotcha. That explains the private address issue. Redash is running in a private network via Docker Compose. Which is why the JSON data source filters out private IP addresses.
You need to add a routing rule to your Docker configuration that passes traffic to and from PRTG.
Well that might sound like a solution for the issue. Do you happen to know, how to implement this routing rule? Or know a place, where i can figure out how to do it?
Actually the filtering/check happens in the Query Runner implementation:
This is to avoid people using the JSON data source to access information they are not supposed to, like AWS metadata API.
Happy to accept a PR that makes this behavior configurable with an environment variable. Just note that if you disable this check, you need to trust whoever you allow running queries in your system.
Ahh okay, then i get it. So, my question is now - how can I add this environment variable in order to control that behavior? I am the only user, so no chance of any users executing stuff they should not execute
Good syntax. Need to check rights of this file, must be same userid as inside container (1000 ?).
And after, still not working on my side because file is mounted to late and is not the one used at startup (restart nginx container only has no effect). But when going inside container + cat the file, it’s the good version.