...then move on to configuring *prometheus* I meant. On Wednesday 8 May 2024 at 07:11:46 UTC+1 Brian Candler wrote:
> - 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. > > On Tuesday 7 May 2024 at 21:24:18 UTC+1 Christian Sanchez wrote: > >> Hello, all. >> >> I've started to learn Prometheus and found out about the >> postgres_exporter. I'd like to include metrics from the PostgreSQL server I >> have running on Google Cloud. >> >> I don't understand how to actually build out the postgres_exporter.yml >> file. The prometheus-community GitHub repository >> <https://github.com/prometheus-community/postgres_exporter> doesn't seem >> to have examples of building this file out. >> >> Maybe I am not reading the README in the repo that well, but I'd like to >> see some examples of the exporter file. >> >> When running the Prometheus container, this is where I'm expecting to see >> the exporter query options (see attachment) >> >> >> I am running Prometheus and the Postgres Exporter through Docker Compose. >> Here is my docker-compose.yml file: >> version: '3' >> services: >> prometheus: >> image: prom/prometheus >> volumes: >> - "./prometheus.yml:/etc/prometheus/prometheus.yml" >> ports: >> - 9090:9090 >> >> postgres-exporter: >> image: prometheuscommunity/postgres-exporter >> volumes: >> - "./postgres_exporter.yml:/postgres_exporter.yml:ro" >> ports: >> - 9187:9187 >> environment: >> DATA_SOURCE_NAME: " >> postgresql://my-user:[email protected]:5432/my-database?sslmode=disable >> " >> >> >> Here is my prometheus.yml file: >> global: >> scrape_interval: 45s >> >> scrape_configs: >> - job_name: 'prometheus' >> static_configs: >> - targets: ['localhost:9090'] >> >> - job_name: 'postgresql_exporter' >> static_configs: >> - targets: ['host.docker.internal:5432'] >> >> >> -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/8d5d968c-0714-4ffe-885d-911e1a243cc9n%40googlegroups.com.

