Blackbox exporter bearer token config not working

1,122 views
Skip to first unread message

Karan Kapoor

unread,
May 22, 2018, 2:23:23 PM5/22/18
to promethe...@googlegroups.com

Hi All,

 

I am using following blackbox configuration. I am trying to reach marathon ping endpoint ( https://ip/ marathon/ping). I give that to Prometheus to scrape blackbox exporter.

 

modules:

  http_2xx:

    prober: http

    timeout: 5s

    http:

      preferred_ip_protocol: ip4

      valid_status_codes: []

      method: GET

      # The bearer token for the targets.

      bearer_token:  <Token>

      #bearer_token_file: /Users/kkapoor/go/src/github.com/prometheus/blackbox_exporter/token.txt

     

 

Here are the logs from the blackbox probe. I am getting 401 status code. I can do curl at the same time which works fine.

 

Blackbox exporter.

Logs for the probe:

ts=2018-05-22T18:07:05.028046578Z caller=main.go:118 module=http_2xx target=https://ui.dcos.dev.bed.athenahealth.com/marathon/ping level=info msg="Beginning probe" probe=http timeout_seconds=4.5

ts=2018-05-22T18:07:05.028336363Z caller=utils.go:42 module=http_2xx target=https://ui.dcos.dev.bed.athenahealth.com/marathon/ping level=info msg="Resolving target address" preferred_ip_protocol=ip4

ts=2018-05-22T18:07:05.03429647Z caller=utils.go:65 module=http_2xx target=https://ui.dcos.dev.bed.athenahealth.com/marathon/ping level=info msg="Resolved target address" ip=<IP>

ts=2018-05-22T18:07:05.034387871Z caller=http.go:305 module=http_2xx target=https://ui.dcos.dev.bed.athenahealth.com/marathon/ping level=info msg="Making HTTP request" url=<URL>

ts=2018-05-22T18:07:05.055821557Z caller=http.go:326 module=http_2xx target=https://ui.dcos.dev.bed.athenahealth.com/marathon/ping level=info msg="Received HTTP response" status_code=401

ts=2018-05-22T18:07:05.055869898Z caller=http.go:341 module=http_2xx target=https://ui.dcos.dev.bed.athenahealth.com/marathon/ping level=info msg="Invalid HTTP response status code, wanted 2xx" status_code=401

ts=2018-05-22T18:07:05.055908172Z caller=http.go:380 module=http_2xx target=https://ui.dcos.dev.bed.athenahealth.com/marathon/ping level=info msg="Response timings for roundtrip" roundtrip=0 start=2018-05-22T14:07:05.034566766-04:00 dnsDone=2018-05-22T14:07:05.034566766-04:00 connectDone=2018-05-22T14:07:05.03844036-04:00 gotConn=2018-05-22T14:07:05.052123031-04:00 responseStart=2018-05-22T14:07:05.055750086-04:00 end=2018-05-22T14:07:05.055777178-04:00

ts=2018-05-22T18:07:05.056034467Z caller=main.go:131 module=http_2xx target=https://ui.dcos.dev.bed.athenahealth.com/marathon/ping level=error msg="Probe failed" duration_seconds=0.02782808

 

Curl output.

curl -X GET -H "Authorization: token=$(dcos config show core.dcos_acs_token)" $(dcos config show core.dcos_url)/marathon/ping

pong

 

It would be great if someone can help here.

 

Regards,

Karan Kapoor

Brian Brazil

unread,
May 22, 2018, 8:20:20 PM5/22/18
to Karan Kapoor, promethe...@googlegroups.com
This is not a bearer token, as the commercial Marathon does not support them. They have their own unique auth using "token" rather than the standard "Bearer" in the header. You can specify this as a header explicitly, though it won't be considered a secret.

Brian
 

pong

 

It would be great if someone can help here.

 

Regards,

Karan Kapoor

--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/D1C67213-5B32-44CB-A3DD-5851480FC74F%40contoso.com.
For more options, visit https://groups.google.com/d/optout.



--

Karan Kapoor

unread,
May 22, 2018, 8:47:26 PM5/22/18
to Brian Brazil, promethe...@googlegroups.com
Hi Brian,
Thanks for the pointer. Ill look into it. I just want to make sure this is really a DC/OS endpoint which is handling the auth. 
It proxies request to marathon endpoint. 

Ill try to explicitly set in header to see if it works and get back to you. 


From: Brian Brazil <brian....@robustperception.io>
Sent: Tuesday, May 22, 2018 8:20:17 PM
To: Karan Kapoor
Cc: promethe...@googlegroups.com
Subject: Re: [prometheus-users] Blackbox exporter bearer token config not working
 
Reply all
Reply to author
Forward
0 new messages