I am trying to setup blackbox exporter with my web server but I keep getting an error. I believe the error is being caused by blackbox making a HTTP request to a HTTPS URL.
I have removed the IP address and domain name from the log for security. My website has an SSL certificate assigned to it via DigiCert.
Here is the log: Logs for the probe: level=info msg="Making HTTP request" url=https://00.00.40.248 host=DOMAINNAME level=error msg="Error for HTTP request" err="Get "https://00.00.40.248": tls: failed to verify certificate: x509: certificate signed by unknown authority"
I've tried numerous changes to my prometheus and blackbox config file but the configuration I currently have is the best results I've gotten. I can see the domain name in the prometheus UI with the target using HTTPS.
Prometheus.yml
scrape_configs:
- job_name: 'webserver'
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
- https://DOMAINNAME
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 192.00.00.18:9115
- job_name: 'prometheus'
static_configs:
- targets:
- localhost:9090 # Replace with the address where Prometheus is running
Blackbox.yml
modules:
http_2xx:
prober: http
timeout: 5s
http:
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
valid_status_codes: []
method: GET
preferred_ip_protocol: "ip4"
ip_protocol_fallback: false
icmp:
prober: icmp
icmp:
preferred_ip_protocol: "ip4"
ip_protocol_fallback: false
To resolve the problem, I updated my blackbox.yml file to the below.