PostgreSQL custom query is not working

Description

I have configured the below custom query in the below path, but I am unable to see the metric in the Explore dashboard.

Path: /usr/local/percona/pmm2/collectors/custom-queries/postgresql/low-resolution/queries-lr.yaml

Forum Ticket: https://forums.percona.com/t/postgresql-custom-query-is-not-working/34390

Below is the custom query,

pg_user_process: query: “SELECT usename as USER, client_addr as IP, COUNT(client_addr) as THREAD_COUNT FROM pg_stat_activity GROUP BY client_addr,usename ORDER BY usename, client_addr” metrics: - list: usage: “GAUGE” description: “Id details” - USER: usage: “LABEL” description: “User Name” - IP: usage: “LABEL” description: “User Client IP” - THREAD_COUNT: usage: “LABEL” description: “no of connections per thread.”

How to test

None

How to document

None

Activity

Show:

Naresh 
February 12, 2025 at 4:56 PM

Please close this ticket. I am able to fix the issue.

Aaditya Dubey 
November 18, 2024 at 10:23 AM

Hi

Thank you for the report.

I see here https://forums.percona.com/t/postgresql-custom-query-is-not-working/34390/7 that you are using incorrect custom query so postgres_exporter can’t extract it from result and can’t create metric because of that.

Please let me know if it is helpful.

Naresh 
November 6, 2024 at 4:33 PM

pg_user_process: query: “SELECT usename as USER, client_addr as IP, COUNT(client_addr) as THREAD_COUNT FROM pg_stat_activity GROUP BY client_addr,usename ORDER BY usename, client_addr” metrics: - list: usage: “GAUGE” description: “Id details” - USER: usage: “LABEL” description: “User Name” - IP: usage: “LABEL” description: “User Client IP” - THREAD_COUNT: usage: “LABEL” description: “no of connections per thread.”
Not a Bug

Details

Assignee

Reporter

Priority

Labels

Needs QA

Needs Doc

Due date

Created November 6, 2024 at 4:33 PM
Updated February 12, 2025 at 4:58 PM
Resolved February 12, 2025 at 4:58 PM

Flag notifications