Basic Auth for Prometheus End Points

4,949 views
Skip to first unread message

Anthony Davis

unread,
Mar 27, 2018, 8:49:56 AM3/27/18
to promethe...@googlegroups.com
Hi All,

I am having a bit of a problem with authenticating against an endpoint to get metrics.

I have setup Traefik as a reverse proxy with authentication in place. If i test via a web browser I authenticate and cant view the metrics. When I setup Prometheus to do this i get an error saying not authorised. "server returned HTTP status 401 Unauthorized"

Here is my config with IPs removed:

global:
  scrape_interval: 15s
  scrape_timeout: 10s
  evaluation_interval: 15s
rule_files:
- /opt/prometheus/prometheus/rules/alert.cpu.yml
- /opt/prometheus/prometheus/rules/alert.memory.yml
scrape_configs:
- job_name: prometheus
  scrape_interval: 15s
  scrape_timeout: 10s
  metrics_path: /metrics
  scheme: http
  static_configs:
  - targets:
    - localhost:9090
- job_name: mail
  scrape_interval: 15s
  scrape_timeout: 10s
  metrics_path: /metrics
  scheme: http
  static_configs:
  - targets:
    - xx.xx.xx.xx
  basic_auth:
    username: test2
    password: <secret>
I have the latest version of prometheus 2.2.1.

Can anyone help and tell me what I am doing wrong please?

Thanks!

dob...@gmail.com

unread,
Apr 6, 2018, 5:29:59 AM4/6/18
to Prometheus Users

Sounds like you have to figure out how to configure Traefik, I'm not sure anyone on the prometheus list will have much to say about that.

Dobes Vandermeer

unread,
Apr 6, 2018, 1:58:49 PM4/6/18
to Prometheus Users
Did you mean to say that if you connect to the mail target yourself using the browser using basic auth you can get the metrics, but Prometheus complains that it cannot get the metrics due to status 401?

If so, sorry for the misunderstanding.  It would seem like Prometheus didn't send the right basic auth in that case.  I'm not sure how best to diagnose that.

--
You received this message because you are subscribed to a topic in the Google Groups "Prometheus Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/prometheus-users/W2qs01pOtzk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/91220cec-4ef8-4a1a-8f43-7d1a054b7673%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sams...@gmail.com

unread,
Jul 12, 2018, 10:44:33 AM7/12/18
to Prometheus Users
Did you figure this out? Having the same issue. Thanks
Reply all
Reply to author
Forward
0 new messages