- job_name: 'postgresql_exporter'
static_configs:
- targets: ['host.docker.internal:5432']
One problem I can see is that you're trying to get prometheus to scrape the postgres SQL port. If you go to the Prometheus web UI and look at the Status > Targets menu option, I think you will see it's currently failing. Or run the query "up == 0".
You need to change it to scrape prometheus exporter: that is port 9187, not port 5432.
However, before you get around to configuring prometheus, I suggest you first make sure that postgres-exporter itself is working properly, by scraping it manually:
curl x.x.x.x:9187/metrics
(or inside the exporter container you could try curl
127.0.0.1:9187/metrics, but that depends if the container has a "curl" binary)
Once you're able to do that (which may also require adjusting your postgres_exporter.yml and/or pg_hba.conf, then move on to configuring postgres.