What you've put in prometheus.yml under 'targets' is wrong.  
Blackbox_exporter does not run external programs such as curl.  The target 
should be a URL, not a command line.

I suggest you forget about prometheus.yml to start with, and get 
blackbox_exporter running by itself - and you can hit blackbox_exporter 
with curl.  If you do this, then you can add debug=true to get more 
information:

curl -vg 'host.docker.internal:9115/probe?module=http_post_2xx&target=
https://asdf.b.cloud:443/whatever&debug=true 
<https://asdf.b.cloud/whatever&debug=true>'

Only after you've got that working, then you can move on to configuring 
prometheus.

However, what's clear from the above is you've put nothing in blackbox.yml 
to configure authentication. For the settings you need, see 
https://github.com/prometheus/blackbox_exporter/blob/master/CONFIGURATION.md#http_probe
Assuming that you can connect to the API directly using -u 
username:password, then what you're looking for is "basic auth":

modules:
  http_2xx_with_auth:
    prober: http
    http:
      basic_auth:
        username: my_username
        password: my_password
      ... other settings as required (e.g. method: POST, headers, body etc 
...

On Tuesday, 7 June 2022 at 14:27:44 UTC+1 santanum...@gmail.com wrote:

> Hi Team,
>       I have a requirement to monitor the authenticated API endpoint using 
> Balckbox Exporter and Prometheus. I am unable to figure out the solution. 
> Please help!
> The Blackbox exporter gives 200 success message for APIs without 
> authentication though. 
> I am putting the yml files for blackbox exporter and Prometheus.
>
> blackbox.yml
> [image: Screen Shot 2022-06-06 at 12.03.19 PM.png]
>
> prometheus.yml
>
> [image: Screen Shot 2022-06-06 at 12.07.41 PM.png]
>
> Note: I tried with http_2xx and it didn't help either.
>
> Thanks!
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/685d921b-2905-460a-99c2-692a10c38dc2n%40googlegroups.com.

Reply via email to