Skip to content

Option to not query replication stats #29

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

Closed
jcollie opened this issue Sep 23, 2016 · 2 comments
Closed

Option to not query replication stats #29

jcollie opened this issue Sep 23, 2016 · 2 comments

Comments

@jcollie
Copy link

jcollie commented Sep 23, 2016

The databases that I currently monitor do not have replication enabled, so every time Prometheus scrapes the exporter, I get these messages in the logs:

Sep 22 20:23:56 svr03.ocjtech.us postgres[11980]: [2-1] ERROR:  relation "pg_replication_slots" does not exist at character 162
Sep 22 20:23:56 svr03.ocjtech.us postgres[11980]: [2-2] STATEMENT:
Sep 22 20:23:56 svr03.ocjtech.us postgres[11980]: [2-3]             SELECT *, pg_current_xlog_location(), pg_xlog_location_diff(pg_current_xlog_location(), replay_location)::float FROM pg_stat_replication
Sep 22 20:23:56 svr03.ocjtech.us postgres[11980]: [2-4]                     INNER JOIN pg_replication_slots ON pg_stat_replication.pid=pg_replication_slots.active_pid

It'd be good if there was a command line switch to turn off these queries, it'd be GREAT if the exporter could determine that replication wasn't in use automatically and not issue these queries.

ncabatoff added a commit to ncabatoff/dbms_exporter that referenced this issue Oct 8, 2016
…for querying SHOW variables - this can generally be done by querying pg_settings instead. Fixes prometheus-community#29 and prometheus-community#30 upstream.
@wrouesnel
Copy link
Contributor

This is indeed a problem. The main issue is there's now way for the exporter to know if replication should be enabled or not. I think the fix is just going to be a command line flag "expect-replication" which raises this to the level of error and ignores it otherwise (since I don't want to break backwards compatibility for people using it this way already).

@draeron
Copy link

draeron commented Mar 19, 2019

i had issue with running the exporter with a aurora rds database (which is compatible with postgres 9.6.8).

This what you'll get in the exporter logs :

Error running query on database:  pg_stat_replication pq: Function pg_stat_get_wal_senders() is currently not supported in Aurora

Seems like aurora doesn't expose replication information and honestly we don't really care for those metrics anyway but we do want the other metrics. So i checked out the code and remove everything related pg_stat_replication.

Since this might happen to someone else i though it would be useful to post this here. I could do a proper PR for this if you are interested in this behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants