Closed karaolidis closed 2 years ago
This seems similar to #217 but the original author unfortunately closed the issue without explaining how they solved it.
2022/08/02 23:22:20 ERROR: invalid character '<' looking for beginning of value
That message means that the response from the api is HTML rather than JSON. That's because the Scrutiny webserver is configured to return the index.html
page if it cant find a route.
I see that you're running the scrutiny omnibus image behind Nginx.
Can you curl the following urls and paste the output below (i want to know if its JSON or not)
http://localhost:8080/storage/api/health
- do this inside the containerhttp://YOUR_HOSTNAME_HERE/storage/api/health
- do this outside your container, using your configured NGINX hostname/iphttp://localhost:8080/storage/api/health
seems to be returning JSON: {"success":true}
http://YOUR_HOSTNAME_HERE/storage/api/health
seems to be returning a 302 found page:
<html>
<head><title>302 Found</title></head>
<body>
<center><h1>302 Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
This redirects to the JSON response after that.
Now that I'm looking at it, this seems to be happening because I have Authelia in front of the /storage
endpoint. Is there a way to have the collector point to the API via the internal docker network instead?
is your collector still configured using the following config file?
api:
endpoint: 'http://localhost:8080/storage'
In that case it should be using the internal route to the API.
Do you run multiple collectors, on different hosts?
Using both localhost
and scrutiny
(the container name) leads to the same issue. This is the only collector running at the moment.
hm, in that case, I wonder if the collector isn't correctly picking up your api.endpoint
change.
yeah, thats the reason:
bodyType=response clientIP=127.0.0.1 hostname=105b5dd257b6 latency=1 method=POST path=/api/devices/register
the path in the access logs you uploaded is /api/devices/register
not /storage/api/devices/register
Let me see if I can reproduce this locally.
In the meantime, can you try running your scrutiny container with the following environmental variable:
COLLECTOR_API_ENDPOINT=http://localhost:8080/storage
Setting the environment variable seems to fix the issue without any other changes. Any ideas on why the collector is not detecting the change?
I'm trying to replicate this issue locally, but I have confirmed that a mounted collector.yaml
file will be correctly parsed by the collector and the api.endpoint
will be used.
Can you take a look at this troubleshooting guide and see if there's anything relevant/unique to your configuration?
https://github.com/AnalogJ/scrutiny/blob/master/docs/TROUBLESHOOTING_REVERSE_PROXY.md
The only difference is the Authelia redirection which is somehow fixed using the environment variable. Another reason I could think of would be invalid permissions on the mounted config file but I also tested that extensively and didn't get different results.
Closing the issue since this is probably unrelated to scrutiny. Thanks for all the help!
weird. I just released v0.5.0
which adds some additional messages when in DEBUG
mode -- it prints out a copy of the configuration object.
If you want to debug further, we can remove the env var, re-use the collector config file, turn on DEBUG mode, and then verify the settings were correctly parsed by Scrutiny.
I've just had the exact same issue.
Setting api.endpoint
in collector.yaml
didn't work, and the API call continued to not use the prefix.
Once I set up the COLLECTOR_API_ENDPOINT
env var, it worked.
(on docker)
The scrutiny.yaml
config is definitely used, because the basedir
isn't being ignored.
I had collector.yaml
in the same place.
I'm using scrutiny:master-omnibus
.
To add to this if you are using a reverse proxy you may need to add /api to the proxy pass. For some reason it gets a bit huffy over just plain / as location for the api endpoint.
Describe the bug I've been experiencing some really weird behavior recently: if I set
web.listen.basepath
to anything other than the default of''
, the collector breaks with the following error message:The value of
api.endpoint
seems to not influence the error.scrutiny.yaml
:collector.yaml
(can be set to anything without changing proxy settings and still works)log.txt
Expected behavior The following is an example of running the collector with
basepath: ''
:docker-compose.yml
nginx.conf
snippetdocker info
I'd appreciate any help :)