postgres_exporter icon indicating copy to clipboard operation
postgres_exporter copied to clipboard

pg_stat_statements exists but postgres-exporter complains that it doesn't

Open alasgarov83 opened this issue 5 years ago • 3 comments

Can anyone suggest what is the issue? root user was given superuser rights on postgres db, I ran create extension pg_stat_statements; extension was created and checking with \dx i can see it is there in public schema. Then superuser rights were removed from root user. I have installed postgres exporter (using root user in values.yaml), in logs of the pod I can see an error that no pg_stat_statements extension exists. I see that root has right for using public schema, also on another DB this method worked. I am a bit confused here. Any help would be appreciated!

alasgarov83 avatar Oct 20 '20 11:10 alasgarov83

me too I have the same problem。

postgrepsql version: 12.0 postgreps-exporter version: 0.14.0

ts=2023-09-28T09:10:37.268Z caller=main.go:86 level=warn msg="Error loading config" err="Error opening config file "postgres_exporter.yml": open postgres_exporter.yml: no such file or directory" ts=2023-09-28T09:10:37.268Z caller=proc.go:250 msg="Excluded databases" databases=[] ts=2023-09-28T09:10:37.268Z caller=main.go:99 level=warn msg="The extended queries.yaml config is DEPRECATED" file=queries.yaml ts=2023-09-28T09:10:37.269Z caller=tls_config.go:274 level=info msg="Listening on" address=[::]:9187 ts=2023-09-28T09:10:37.269Z caller=tls_config.go:277 level=info msg="TLS is disabled." http2=false address=[::]:9187 ts=2023-09-28T09:10:43.986Z caller=server.go:74 level=info msg="Established new database connection" fingerprint=10.16.65.12:5432 ts=2023-09-28T09:10:43.988Z caller=postgres_exporter.go:613 level=info msg="Semantic version changed" server=10.16.65.12:5432 from=0.0.0 to=12.0.0 ts=2023-09-28T09:10:44.026Z caller=namespace.go:236 level=info err="Error running query on database "192.168.2.11:5432": pg_stat_statements pq: relation "pg_stat_statements" does not exist" ts=2023-09-28T09:10:44.027Z caller=postgres_exporter.go:682 level=error err="queryNamespaceMappings returned 1 errors" ts=2023-09-28T09:10:51.891Z caller=namespace.go:236 level=info err="Error running query on database "192.168.2.11:5432": pg_stat_statements pq: relation "pg_stat_statements" does not exist" ts=2023-09-28T09:10:51.911Z caller=postgres_exporter.go:682 level=error err="queryNamespaceMappings returned 1 errors"

chinaboy007 avatar Sep 28 '23 09:09 chinaboy007

Have you solved this issue?

aunghtetnay avatar Jul 02 '24 06:07 aunghtetnay

You must check that the extension is created in every database apart from template ones. postgres database and the application databases as well, execute the CREATE EXTENSION command on all of them.

I recommend execute it into template1, so any new database will have the extension already created.

isaiasanchez avatar Aug 20 '24 10:08 isaiasanchez