Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting "fetchHTTP failed HTTP status 401" error #66

Open
tdabasinskas opened this issue Jul 24, 2018 · 1 comment
Open

Getting "fetchHTTP failed HTTP status 401" error #66

tdabasinskas opened this issue Jul 24, 2018 · 1 comment

Comments

@tdabasinskas
Copy link

Hi,

We are facing a strange issue with nginx-vts-exporter (v0.10.3). The exporter keeps flooding /var/log/messages with the following error:

#tail -n 10 /var/log/messages | grep nginx
nginx-vts-exporter: 2018/07/24 10:04:50 fetchHTTP failed HTTP status 401

In addition, it only exports the following metric:

#curl http://localhost:9913/metrics
# HELP nginx_vts_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, and goversion from which nginx_vts_exporter was built.
# TYPE nginx_vts_exporter_build_info gauge
nginx_vts_exporter_build_info{branch="HEAD",goversion="go1.10",revision="8aa2881c7050d9b28f2312d7ce99d93458611d04",version="0.10.3"} 1

We are using the default configuration (no environment variables or command line parameters), meaning it should be scraping http://localhost/status URL. The interesting part is that trying to CURL this URL from the server works perfectly:

# curl -sSL -D - http://localhost/status -o /dev/null
HTTP/1.1 200 OK
Server: nginx/1.14.0
Date: Tue, 24 Jul 2018 08:07:32 GMT
Content-Type: application/json
Content-Length: 50803
Connection: keep-alive

Some of the Nginx VHosts are indeed protected by basic auth, which could possibly result in 401, but localhost should not require the auth (which is confirmed by the CURL result above).

One more thing worth mentioning is that restarting nginx-vts-exporter solves the problem for some time (it starts getting the metrics properly). Anyhow, after some time it breaks again.

Any ideas what might be happening here?

@ykfq
Copy link

ykfq commented Nov 14, 2020

You should add these two lines in nginx.conf inside http:

    vhost_traffic_status_zone shared:vhost_traffic_status:32m;
    vhost_traffic_status_filter_by_host on;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants