# Custom Query : not showing up?

**URL:** <https://forums.percona.com/t/custom-query-not-showing-up/14656>\
**Category:** PMM 2.x\
**Created:** [March 8, 2022, 10:26am UTC](https://forums.percona.com/t/custom-query-not-showing-up/14656 "2022-03-08T10:26:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew2](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/andrew2/32/4044_2.png) [@Andrew2](https://forums.percona.com/u/Andrew2)\
**Post date:** [March 8, 2022, 10:26am UTC](https://forums.percona.com/t/custom-query-not-showing-up/14656/1 "2022-03-08T10:26:31Z")

</div>

I’ve tried creating a custom query to check for partitions older than a certain date to assist in data retention management.  
I’ve added a query to :  
/usr/local/percona/pmm2/collectors/custom-queries/mysql/low-resolution/queries-mysqld.yml

```auto

custom_mysql_partition_check: ## The namespace (prefix of the metric name) for the custom query.
    query: "select count(1) as CNT,TABLE_SCHEMA, TABLE_NAME from information_schema.partitions where table_name = '[tablename]' and str_to_date( replace(PARTITION_DESCRIPTION,"'","") , '%Y-%m-%d' ) <= date_add(date_add(LAST_DAY(NOW()),interval 1 DAY),interval -4 MONTH) GROUP BY TABLE_SCHEMA,TABLE_NAME;"
    metrics:
      - COUNT:
         usage: "COUNTER"
         description: "Number of old partitions"
      - TABLE_NAME:
         usage: "LABEL"
         description: "Table name"
      - PARTITION_NAME:
         usage: "LABEL"
         description: "Partition Name"
      - TABLE_SCHEMA:
         usage: "LABEL"
         description: "Schema Name"

```

howewever, I’m not seeing the custom query in the dashboard dropdown under advanced data exploration, but nor am I seeing any errors in my pmm-agent.log

Have I missed something in how to enable the custom queries or the parsing of the path and yml file of the custom queries?

---

<div class="post-metadata">

**Author:** ![nurlan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/nurlan/32/1523_2.png) [@nurlan](https://forums.percona.com/u/nurlan)\
**Post date:** [March 14, 2022, 10:10am UTC](https://forums.percona.com/t/custom-query-not-showing-up/14656/2 "2022-03-14T10:10:10Z")

</div>

Hi @Andrew2,  
Have you restarted pmm-agent or mysqld\_exporter?

---

<div class="post-metadata">

**Author:** ![andrrreasss](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@andrrreasss](https://forums.percona.com/u/andrrreasss)\
**Post date:** [November 5, 2022, 1:48pm UTC](https://forums.percona.com/t/custom-query-not-showing-up/14656/3 "2022-11-05T13:48:49Z")

</div>

I have the same problem. Queries are working and metrics give information if you look at the client.

pg\_buffercache\_buffered{collector=“custom\_query.lr”,datname=“1”,relname=“1”,server=“10.1.1.2:5432”} 2  
HELP pg\_buffercache\_buffers\_percent  
TYPE pg\_buffercache\_buffers\_percent gauge  
pg\_buffercache\_buffers\_percent{collector=“custom\_query.lr”,datname=“1”,relname=“1”,server=“10.1.1.2:5432”} 3  
HELP pg\_buffercache\_percent\_of\_relation  
TYPE pg\_buffercache\_percent\_of\_relation gauge  
pg\_buffercache\_percent\_of\_relation{collector=“custom\_query.lr”,datname=“1”,relname=“1”,server=“10.1.1.2:5432”} 4

But then comes the error message. And I don’t get these metrics data on the server.

HELP pg\_exporter\_user\_queries\_load\_error Whether the user queries file was loaded and parsed successfully (1 for error, 0 for success).  
TYPE pg\_exporter\_user\_queries\_load\_error gauge  
pg\_exporter\_user\_queries\_load\_error{collector=“custom\_query.lr”,filename=“/usr/local/percona/pmm2/collectors/custom-queries/postgresql/low-resolution/pg\_buffercashe.yml”,hashsum=“69483915140e073ccf88d6de9b0856477060d3c540609ce86d7d5b8ef00450a3”} 0

---

<div class="post-metadata">

**Author:** ![nurlan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/nurlan/32/1523_2.png) [@nurlan](https://forums.percona.com/u/nurlan)\
**Post date:** [December 8, 2022, 12:02pm UTC](https://forums.percona.com/t/custom-query-not-showing-up/14656/4 "2022-12-08T12:02:48Z")

</div>

Hi @andrrreasss, by saying “Queries are working and metrics give information” do you mean that you checked exporter ran by PMM or standalone? Could you check file permissions?

---

<div class="post-metadata">

**Author:** ![andrrreasss](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@andrrreasss](https://forums.percona.com/u/andrrreasss)\
**Post date:** [December 12, 2022, 5:15am UTC](https://forums.percona.com/t/custom-query-not-showing-up/14656/5 "2022-12-12T05:15:34Z")

</div>

@nurlan, exporter who launched PMM
