ivinco
[SOLVED] PMM Server Installation Error – Connection Check Failed: Pq: |Peer|Ident|Password Authentication Failed For User “Pmm”.

[SOLVED] PMM Server Installation Error – Connection Check Failed: Pq: |Peer|Ident|Password Authentication Failed For User “Pmm”.

Mykhailo LiepieshkoMykhailo Liepieshko··Updated

When pmm-admin add postgresql fails with pq: peer/ident/password authentication failed for user “pmm”, the issue is almost always in pg_hba.conf, not in PostgreSQL itself. Either the pmm role doesn't exist, or PostgreSQL's host-based access rules are routing the connection through a method (peer, ident) that doesn't accept passwords. The fix is to add an md5 rule for the pmm user.

If you see similar errors when trying to add a PostgreSQL database to pmm-admin, you most likely have a problem authorizing the pmm agent with your database. First you need to make sure that the user “pmm” really exists.

postgres=# \du
List of roles
Role name |                   Attributes                   | Member of
-----------+------------------------------------------------+-----------
pmm       | Superuser                                      | {}
postgres  | Superuser, Create role, Create DB, Replication | {}

If there is no such user, it should be created.

postgres=# CREATE USER pmm WITH SUPERUSER ENCRYPTED PASSWORD 'password';

Or you just forget password – then you can change it with this query:

postgres=# ALTER USER pmm WITH PASSWORD 'new_password';

Now try to connect from this user localy.

psql postgres pmm -c "\conninfo”

Problem still persist?

Most likely, you need to add the ability for your PMM user to log in locally to the PostgreSQL instance. To do this, add the following line to pg_hba.conf:

	# TYPE  DATABASE        USER            ADDRESS                 METHOD
  local   all             pmm                                     md5

And reload configuration

su - postgres
psql -c "select pg_reload_conf()"

If you don’t know where is your pg_hba.conf is placed, you can ask PostgreSQL about it:

postgres=# SHOW hba_file;
                hba_file
    ---------------------------------
     /var/lib/pgsql/data/pg_hba.conf

Try to test connection again.

psql postgres pmm -c "\conninfo"
Password for user pmm:
You are connected to database "postgres" as user "pmm" via socket in "/var/run/postgresql" at port "5432".

Now you are ready to add postgresql service to your PMM server. To add an instance, run this command in your console:

pmm-admin add postgresql \
  --username=pmm \
  --password=pass \
  --server-url=https://admin:admin@X.X.X.X:443 \
  --server-insecure-tls

Problem still persist?

Try to add one more line to pg_hba.conf

# TYPE  DATABASE        USER            ADDRESS                 METHOD
  host    all             pmm             127.0.0.1/32            md5

Reload configuration:

su - postgres
psql -c "select pg_reload_conf()"

And try to add agent:

pmm-admin add postgresql \
--username=pmm \
--password=pass \
--server-url=https://admin:admin@X.X.X.X:443 \
--server-insecure-tls

PostgreSQL Service added.
Service ID  : /service_id/8776b3b2-0c00-4155-a8bd-da6b7414f550
Service name: pmm-test-postgresql
pmm-admin list

Service type        Service name               Address and port        Service ID
PostgreSQL          pmm-test-postgresql        127.0.0.1:5432          /service_id/c7827144-22b0-48f4-937e-f79f0ecf4297

Agent type                           Status           Metrics Mode        Agent ID                                              Service ID                                              Port
pmm_agent                            Connected                            /agent_id/670ce7e3-dab6-4b81-b53e-aa01157f6041                                                                0
node_exporter                        Running          push                /agent_id/8df6ead8-d06c-4080-8ffa-bc5bf20f97c9                                                                42001
postgres_exporter                    Running          push                /agent_id/d0078319-e859-4a01-ad5f-5c0408cdede2        /service_id/c7827144-22b0-48f4-937e-f79f0ecf4297        42006
postgresql_pgstatements_agent        Waiting                              /agent_id/f6799da9-1bb4-48e3-a268-4b45507d47cd        /service_id/c7827144-22b0-48f4-937e-f79f0ecf4297        0
vmagent                              Running          push                /agent_id/26b38532-6532-49c5-97

Need help running PMM at scale or troubleshooting database monitoring infrastructure? See our development services.

Frequently Asked Questions

What does "peer/ident/password authentication failed for user pmm" mean in PostgreSQL?

PostgreSQL is rejecting the connection because the authentication method defined in pg_hba.conf for that user/host combination doesn't accept the credentials pmm-agent is sending. peer checks the OS user, ident uses the ident protocol, and md5/scram-sha-256 accept passwords. PMM needs a method that accepts a password, typically md5.

How do I find pg_hba.conf on my PostgreSQL server?

Run SHOW hba_file; from a psql session connected as a superuser. PostgreSQL will print the absolute path — usually something like /var/lib/pgsql/data/pg_hba.conf or /etc/postgresql/<version>/main/pg_hba.conf depending on your distribution. After editing it, run SELECT pg_reload_conf(); to apply changes without restarting.

Should the PMM PostgreSQL user be a SUPERUSER?

PMM's documentation suggests SUPERUSER for simplicity because the postgres_exporter and pg_stat_statements collector need broad read access. In production, you can grant only pg_monitor (PostgreSQL 10+) plus access to pg_stat_statements instead, which gives PMM what it needs without superuser privileges.

Why do I need both a "local" and a "host" rule in pg_hba.conf for PMM?

The local rule covers Unix socket connections (when pmm-agent runs on the same machine as PostgreSQL and connects via /var/run/postgresql). The host 127.0.0.1/32 rule covers TCP connections to localhost. pmm-agent may use either depending on how the service is configured, so adding both rules avoids edge cases.