Description
When creating and using a custom PMM user without creating a namesake database as well, PostgreSQL error log gets flooded with errors:
2019-10-22 07:38:06.066 PDT [27434] FATAL: database "pmm_user" does not exist 2019-10-22 07:39:00.008 PDT [27455] FATAL: database "pmm_user" does not exist 2019-10-22 07:40:00.007 PDT [27461] FATAL: database "pmm_user" does not exist 2019-10-22 07:41:00.005 PDT [27521] FATAL: database "pmm_user" does not exist 2019-10-22 07:42:00.004 PDT [27538] FATAL: database "pmm_user" does not exist 2019-10-22 07:43:00.003 PDT [27544] FATAL: database "pmm_user" does not exist 2019-10-22 07:44:00.007 PDT [27549] FATAL: database "pmm_user" does not exist 2019-10-22 07:45:00.005 PDT [27572] FATAL: database "pmm_user" does not exist
Steps to reproduce, adding a PostgreSQL 11 server to PMM:
$ sudo yum install pmm2-client
$ sudo pmm-admin config --server-insecure-tls --server-url=https://admin:[email protected]:443
postgres=# CREATE USER pmm_user WITH SUPERUSER ENCRYPTED PASSWORD 'secret';
$ pmm-admin add postgresql --username=pmm_user --password=secret postgres 127.0.0.1:5432
If we alter the postgres user by setting a password to the role and use it instead then no errors are reported in the error log.
This seems to be related to PostgreSQL defaulting to use the client's username for database name when no database name is supplied in the connection. Either PMM should default to the postgres database or provide a parameter to set which database to use.
Despite the warnings in the error log, PMM is being able to capture PostgreSQL data and display it.