You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What did you do?
I've created PostgreSQL user for monitoring as described in the readme
Run following command if you use PostgreSQL versions >= 10
GRANT pg_monitor to postgres_exporter;
I've installed postgres_exporter and I've run it.
Connected to prometheus without problems.
Created postgres-exporter dashboard in the grafana without problems.
What did you expect to see?
All metrics work as expected.
What did you see instead? Under which circumstances?
In the grafana most of metrics worked succesfully
However during of monitoring of our load testing there was always 1 connection active in Grafana monitoring in the "Connections by state (stacked)" chart.
After checking pg_stat_activity under postgres superuser I've found that there are 480+ connections really, sometimes idle, sometimes active during the test. Environment
System information:
Linux 5.10.0-27-amd64 x86_64
postgres_exporter version:
exporter have been run from the "latest" docker container:
ExecStart=/usr/bin/docker run
--net=host
-e DATA_SOURCE_NAME="postgresql://postgres_metrics_exporter:my_pwd@127.0.0.1:my_pg_port/postgres?sslmode=disable"
--name=postgres-exporter-container quay.io/prometheuscommunity/postgres-exporter:latest
PostgreSQL version:
15.6
Diving down the issue I've found that pg_monitor user rights are not enough to find any connection state from pg_stat_activity:
(note the NULL value in the state column of the output in all the rows except the two)
but when granted pg_read_all_stats to the user, query to the pg_stat_activity worked as expected:
To be able to collect metrics from pg_stat* views as non-superuser in PostgreSQL server versions >= 10 you can grant the pg_monitor or pg_read_all_stats [built-in roles](https://www.postgresql.org/docs/current/predefined-roles.html) to the user
is wrong. I need both pg_monitor AND pg_read_all_stats roles to get states of the connections from grafana by postgres_exporter.
As well as I have need grants
grant pg_monitor, pg_read_all_stats to prometheus_metrics_exporter;
for metrics to work,
not the
Run following command if you use PostgreSQL versions >= 10
GRANT pg_monitor to postgres_exporter;
citation from your docs.
It will not get neither provide to prometheus info about connection states.
Please fix the docs.
The text was updated successfully, but these errors were encountered:
I will fix here key link for the solution: https://dba.stackexchange.com/a/259142
pg_read_all_stats are mandatory.
Even though there is a words in PG docs https://www.postgresql.org/docs/current/predefined-roles.html
that pg_monitor is a member "This role is a member of pg_read_all_settings, pg_read_all_stats and pg_stat_scan_tables",
somehow it is not.
user with pg_monitor cannot show states of the connections without a pg_read_all_stats.
What did you do?
I've created PostgreSQL user for monitoring as described in the readme
I've installed postgres_exporter and I've run it.
Connected to prometheus without problems.
Created postgres-exporter dashboard in the grafana without problems.
What did you expect to see?
All metrics work as expected.
What did you see instead? Under which circumstances?
In the grafana most of metrics worked succesfully
However during of monitoring of our load testing there was always 1 connection active in Grafana monitoring in the "Connections by state (stacked)" chart.
After checking pg_stat_activity under postgres superuser I've found that there are 480+ connections really, sometimes idle, sometimes active during the test.
Environment
System information:
Linux 5.10.0-27-amd64 x86_64
postgres_exporter version:
exporter have been run from the "latest" docker container:
ExecStart=/usr/bin/docker run
--net=host
-e DATA_SOURCE_NAME="postgresql://postgres_metrics_exporter:my_pwd@127.0.0.1:my_pg_port/postgres?sslmode=disable"
--name=postgres-exporter-container
quay.io/prometheuscommunity/postgres-exporter:latest
PostgreSQL version:
15.6
Diving down the issue I've found that pg_monitor user rights are not enough to find any connection state from pg_stat_activity:
(note the NULL value in the state column of the output in all the rows except the two)
but when granted pg_read_all_stats to the user, query to the pg_stat_activity worked as expected:
So, the citation from the manual
is wrong. I need both pg_monitor AND pg_read_all_stats roles to get states of the connections from grafana by postgres_exporter.
As well as I have need grants
for metrics to work,
not the
citation from your docs.
It will not get neither provide to prometheus info about connection states.
Please fix the docs.
The text was updated successfully, but these errors were encountered: