PostgreSQL Server not visible in QAN

Hi to all. I’m new in PMM2 and I’ve recently installed PMM2 and added the PostgreSQL 11 server. I’ve installed pg_stat_monitor. I’ve done it as it mentioned in this document (PostgreSQL - Percona Monitoring and Management). As a result, this server has appeared in “PostgreSQL Instance Overview” dashboard but has not appeared in QAN (Query Analytics). What else do I need to do to make it appear in QAN?

1 Like

Hi Nikode,

It can be possible that you have metrics and not queries, since the exporters are different. The first thing I would check here is if pg_stat_monitor is indeed working as expected:

postgres=# select count(*) from pg_stat_monitor;

And check the PostgreSQL log file, too. If it is, you can then check the PMM client-side logs:

sudo journalctl -u pmm-agent | tail

If it’s working correctly, you should see no error messages and also see messages about buckets being sent.
You can also get the PMM server logs and inspect the different processes running within the server itself. Click on the cogwheel at the bottom left and you should get the download button to get a zip file with all logs.
Finally, make sure that you are selecting a time range in which you were effectively gathering data.
Let me know what you are able to find out with this, or if you need more guidance on it.


Hello Agustin_G,
First of all thanks for reply.

I am sending you pictures according to your questions:

  1. This is select result

  2. This is sudo journalctl -u pmm-agent | tail result

  3. This is postgresql log file, I don’t use pg_stat_statements

  4. This is qan-api2.log

If you are interested in anything else, I can write to you.
Thanks in advance.

1 Like

Ok, so the pg_stat_monitor extension is working ok. How did you add the instance? Note that you should explicitly use:

shell> pmm-admin add postgresql --help
      --query-source="pgstatements"                  Source of SQL queries, one of: pgstatements, pgstatmonitor, none (default: pgstatements)

So, the command should be like:

shell> pmm-admin add postgresql --query-source=pgstatmonitor [OTHER_OPTIONS]

Since you can’t update an already-running pmm-client, you will need to remove and re-add:

shell> pmm-admin remove postgresql <service_name>

and then use pmm-admin add as shown above.

Let me know if this works.


1 Like

Hello Agustin,

I’ve deleted and added service again, with option --query-source=pgstatmonitor

then I’ve run some selects

but in QAN not shown POSTGRESQL_LCM_PRE service again :frowning:

Thanks in advance.

1 Like

Finally, the service appeared in QAN :slight_smile: , It seems that the service took some time to display on the dashboard :slight_smile:.
Thank you for valuable advice. It seems that the solution was --query-source=pgstatmonitor
Thank a lot and HAPPY NEW YEAR! :wink:

1 Like

Glad to hear it worked! Thanks for the update.

Happy new year to you too! :slight_smile:

1 Like