-
Notifications
You must be signed in to change notification settings - Fork 762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exclude-databases does not properly work #588
Comments
Hello, I've the same behavior. I use v0.10 in docker. |
Hey, same here. Exclude Parameter doesnt seem to do anything. We use 0.10.0 as well |
Hey, same here. According to the documentation when you specify --auto-discover-databases (or env variables PG_EXPORTER_AUTO_DISCOVER_DATABASES) the databases are retrieved with the following query:
so postgres (that is the current database and templateX should be automatically discarded even if you don't put them in the exclude list). I verified the query on my DB and it works, but when executed by the postgres_exporter it doesn't. |
I think the answer to this question is here: First of all, you don't need to specify postgres, template and template1 in the exclude list. If you define a connection string referencing the database postgres, i.e. like this: the autodiscovery will be done using this query:
Now this doesn't mean that you don't see these DBs in your metrics:
because it depends on the king of statistics table the postgres exporter query. For some of them (global data) it is inevitable to see them. |
This is the PR that introduced the autodiscovery query mentioned above: |
+1 AWS RDS
|
+1 |
+1 same on 0.11.1 and azure postgresql. |
I think I understand the problem. The builtin pg_database collector is trying to collect metrics on those databases automatically. It appears that the pg_database_size() function requires connect permissions. I think the fix is to pass those excluded databases into the collector module and adjusting the built in query to exclude that list. |
+1. Still have this issue on v0.11.1 with azure psql. |
I may be wrong, but regarding the original issue, if the Postgres exporter is connecting to the database using |
Same issue while using |
@The-Seyed I don’t think you’re in the same situation as the one describe in this report (see my comment above for what I think is the explanation of the observed behaviour, which is not a bug). It seems to me that you’re facing the issue of the newly introduced pg_database collector (https://github.com/prometheus-community/postgres_exporter/releases/tag/v0.11.0) not respecting the |
this is broken when using helm chart 4.5.0 (v0.11.0) database: postgres v 11 (azure for postgres single server) confirmed command for the container: --extend.query-path=/etc/config.yaml --web.listen-address=:9187 --auto-discover-databases --exclude-databases azure_maintenance setting: config:
autoDiscoverDatabases: true
excludeDatabases:
- "azure_maintenance" Log from pg exporter pod (retried every minute): ts=2023-06-28T15:05:04.771Z caller=collector.go:196 level=error msg="collector failed" name=database duration_seconds=0.102746443 err="pq: permission denied for database azure_maintenance"
ts=2023-06-28T15:06:04.923Z caller=collector.go:196 level=error msg="collector failed" name=database duration_seconds=0.254488422 err="pq: permission denied for database azure_maintenance"
ts=2023-06-28T15:07:04.772Z caller=collector.go:196 level=error msg="collector failed" name=database duration_seconds=0.102904026 err="pq: permission denied for database azure_maintenance"
ts=2023-06-28T15:08:04.758Z caller=collector.go:196 level=error msg="collector failed" name=database duration_seconds=0.090230632 err="pq: permission denied for database azure_maintenance"
ts=2023-06-28T15:09:04.799Z caller=collector.go:196 level=error msg="collector failed" name=database duration_seconds=0.130927502 err="pq: permission denied for database azure_maintenance"
ts=2023-06-28T15:10:07.409Z caller=collector.go:196 level=error msg="collector failed" name=database duration_seconds=0.187812674 err="pq: permission denied for database azure_maintenance"
ts=2023-06-28T15:11:04.765Z caller=collector.go:196 level=error msg="collector failed" name=database duration_seconds=0.097777735 err="pq: permission denied for database azure_maintenance" any ideas? |
Hello @Tomasz-Kluczkowski, if you have the |
Thx a lot, I reverted to 0.8.0 since trying 0.13.1 breaks some queries due to breaking changes - but then the exclude databases works properly. I will fix the queries at some point and migrate to 0.13+. sad to see that exclude databases is deprecated though... |
It causes exporter connection to every database in the Postgres and it was disabled for pods a while ago, but I forgot that VMs have a different build path. See this for details: neondatabase/cloud@0a60057 Also remove `--exclude-databases` it seems to be bogus as well, see: prometheus-community/postgres_exporter#588
It causes exporter connection to every database in the Postgres and it was disabled for pods a while ago, but I forgot that VMs have a different build / control path. See this commit for details: neondatabase/cloud@0a60057 Also remove `--exclude-databases` it seems to be bogus as well, see: prometheus-community/postgres_exporter#588
What did you do?
I ran an exporter process including the
auto-discover-databases
andexclude-databases
flags. Also pulling from a custom query files:/tmp/queries.yaml
file includes two different queries:DBs on my instance:
What did you expect to see?
Since I am using
exclude-databases
flag and then excludingpostgres,template0,template1
DBs, then my expectation is postgres exporter connecting tonsoengas
DB and performing the queries on my custom file (/tmp/queries.yaml).According to those queries,
pg_database
should retrieve datname and size for every single database on given instance.pg_database_2
should ONLY show datname and size for the database I am connected to. I've included the proper query filter to do that.So,
pg_database_2
should connect to "nsoengas" DB and report its datname and size.What did you see instead? Under which circumstances?
pg_database
seems to be "showing" what it suppose to show. However,pg_database_2
is showing "postgres" as datname. Since I explicitly included the filterWHERE datname = current_database()
AFAIK it is connecting to "postgres" database and retrieving its sizeIt could be seen while scrapping on the exporter port:
Environment
The text was updated successfully, but these errors were encountered: