percona / pmm

Percona Monitoring and Management: an open source database monitoring, observability and management tool
https://www.percona.com/software/database-tools/percona-monitoring-and-management
GNU Affero General Public License v3.0
678 stars 131 forks source link

How to limit monitor account number? #1406

Open zard14 opened 2 years ago

zard14 commented 2 years ago

Description

HI I check the document, and it can limit monitor account conncetion number.

ALTER USER monitor CONNECTION LIMIT 2;

https://docs.percona.com/percona-monitoring-and-management/setting-up/client/postgresql.html#create-a-database-account-for-pmm

Because I find out if I have five user db, each userdb will open 4 connections, and there will be 20 ilde connctions finally.

If I limit user account "monitor" number as 2, there are only two connections right, but there will be bunch of fatal errors in postgresql log like this.

2022-11-16 01:07:52.590 -04 [493080] monitor@postgres 192.168.XXX.XXX(44096)FATAL: too many connections for role "monitor"

All suggestions are welcome, Thank you!

Expected Results

1.No fatal errors in postgresql

  1. lower monitor account conncetions

Actual Results

bunch of fatal errors in postgresql log like this.

2022-11-16 01:07:52.590 -04 [493080] monitor@postgres 192.168.XXX.XXX(44096)FATAL: too many connections for role "monitor"

Version

pmm server 2.32 pmm client 2.32

Steps to reproduce

No response

Relevant logs

No response

Code of Conduct

denisok commented 2 years ago

@tshcherban is this because we had a fix for it before, but now we have upstream changes: https://github.com/percona/postgres_exporter/blob/main/cmd/postgres_exporter/server.go#L72

https://github.com/prometheus-community/postgres_exporter/pull/655

?

artemgavrilov commented 1 week ago

Hello @zard14 , since PMM 2.42 there is an option that limits connections amount for PG: https://docs.percona.com/percona-monitoring-and-management/setting-up/client/postgresql.html#maximum-connection-limit