blackbox exporter simple auth config

1,191 views
Skip to first unread message

Kaufman Ng

unread,
Feb 19, 2021, 2:47:23 PM2/19/21
to Prometheus Users
I am trying to use the http module to hit a REST endpoint enabled with https and basic authentication. But I keep getting 401 status. I confirmed the username and password works via curl command.

Anything wrong with my blackbox exporter config here? Thanks in advance!

modules:
  http_2xx:
    prober: http
    http:
      method: GET
      valid_status_codes: [200,401]
      fail_if_not_ssl: true
      headers:
        Host: "my-endpoint"
      basic_auth:
        username: "user"
        password: "mypassword"

Marcelo Magallón

unread,
Feb 19, 2021, 3:16:36 PM2/19/21
to Kaufman Ng, Prometheus Users
Wild guess:

In the tls_config part you can optionally a ServerName setting. I'm guessing that's what you are trying to do with the Host header.

Does using that instead fix this?

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/cd5d797d-71a7-46dd-a55a-91a2aca3ddfbn%40googlegroups.com.


--
Marcelo Magallón

Kaufman Ng

unread,
Feb 19, 2021, 4:16:55 PM2/19/21
to Prometheus Users
Thanks Marcelo! Problem solved. I removed the host headers and it is working.

Updated good config:

modules:
  http_2xx:
    prober: http
    http:
      method: GET
      fail_if_not_ssl: true
      basic_auth:
        username: "username"
        password: "password"


Somnath Pandey

unread,
Jul 16, 2021, 11:59:05 AM7/16/21
to Prometheus Users
Hi 

Could you please help with prometheus.yml example configuration for the basic auth ?

I tried with  your updated config in blackbox but NO LUCK.

Thanks in advance.

Message has been deleted

Clemente Machado

unread,
Aug 26, 2021, 9:37:26 AM8/26/21
to Prometheus Users
Hi guys, were you able to validate the host's username and password?
Reply all
Reply to author
Forward
0 new messages