Connection refused when using http monitoring with blackbox_exporter and prometheus


You are trying to set up http endpoint monitoring with prometheus and blackbox_exporter by specifying something like the following:

but you are getting the error (in prometheus targets) that connection was refused.


First specify the ip protocol as ip4 if you are not using ip6 like:

And then make sure that you use the container IP address in the replacement field if you have started blackbox_exporter as a docker container (tip taken from here), which you can find by looking for the container IP address (docker inspect blackbox_exporter | grep IPAddress).

So your prometheus configuration should look like the following (different replacement IP):