unable to probe http endpoints with Basic Auth

113 views
Skip to first unread message

Eswar Rao Bevara

unread,
Mar 16, 2020, 10:18:51 AM3/16/20
to Prometheus Users
Hi,

I have an end point which sits behind Basic Auth. I have to probe the endpoint. I am unable to do so as it is throwing 401 error. Please find my prometheus and blackbox_exporter config.Any help is greatly appreciated.


PROM config:

global:
external_labels:
monitor: 'blackbox'

scrape_configs:
- job_name: 'blackbox' # To get metrics about the exporter itself
scrape_interval: 15s
metrics_path: /metrics
static_configs:
- targets:
- host.docker.internal:9115
- job_name: 'blackbox-http-feedback'
scrape_interval: 10s
scrape_timeout: 10s
metrics_path: /probe
params:
module: [http_2basicauth_test] # Look for a HTTP 200 response.
static_configs:
- targets:
- https://example.com/insights/health # Target to probe with http on port 8080.
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
replacement: ${1}
- source_labels: [__param_target]
target_label: instance
replacement: ${1}
- source_labels: []
regex: .*
target_label: __address__
replacement: host.docker.internal:9115 # The blackbox exporter's real hostname:port.

blackbox config:
modules:
http_2basicauth_test:
prober: http
timeout: 15s
http:
preferred_ip_protocol: "ip4"
method: GET
valid_status_codes: [200, 302]
tls_config:
insecure_skip_verify: true
# headers:
# Host: "feedback.test01.pageplace.de/insights/health"
basic_auth:
username: username
password: password

Thanks
Eswar

Brian Candler

unread,
Mar 16, 2020, 10:57:57 AM3/16/20
to Prometheus Users
Your comment says "Target to probe with http on port 8080" but you didn't include :8080 in the URL, so it will be connecting on port 443.

I suggest you try to connect to the target URL successfully using "curl", including authentication.  Using "-k" is like insecure_skip_verify, and "-v" will show you more information from the exchange.  The 401 error may have a more detailed explanation in the response.

Reply all
Reply to author
Forward
0 new messages