Search
left arrowBack
Mykhailo Liepieshko

Mykhailo Liepieshko

January 16, 2023 ・ Basics

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

If you see similar errors when trying to add a PostgreSQL database to pmm-admin

Most likely you 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
  • Basics