# PMM2 custom mysql query fail

**URL:** <https://forums.percona.com/t/pmm2-custom-mysql-query-fail/7376>\
**Category:** PMM 2.x\
**Created:** [January 11, 2020, 6:45am UTC](https://forums.percona.com/t/pmm2-custom-mysql-query-fail/7376 "2020-01-11T06:45:56Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![sinist3r](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@sinist3r](https://forums.percona.com/u/sinist3r)\
**Post date:** [January 13, 2020, 6:15am UTC](https://forums.percona.com/t/pmm2-custom-mysql-query-fail/7376/3 "2020-01-13T06:15:46Z")

</div>

> [@Peter;55194](#):
>
> There is probably some issue with .yml Are you able to share the full file ?

Here’s my queries-mysqld.yml:

```auto

mysql_performance_schema_group_replication_replication_group_members:
query: "SELECT REGEXP_SUBSTR(i.instance_name, '.+?(?=:)'),c.cluster_name as CLUSTER_NAME,i.*, rgm.* ,IFNULL(rgm.MEMBER_STATE, 'OFFLINE') MEMBER_STATE_UPDATE,case rgm.MEMBER_STATE when 'ONLINE' then 0 when 'RECOVERING' then 1 else 2 end STATUS, case rgm.MEMBER_ROLE when 'PRIMARY' then 0 else 1 end ROLE FROM mysql_innodb_cluster_metadata.clusters c INNER JOIN mysql_innodb_cluster_metadata.instances i ON c.default_replicaset = i.replicaset_id LEFT JOIN performance_schema.replication_group_members rgm ON i.mysql_server_uuid = rgm.MEMBER_ID WHERE &#64;&#64;hostname = (SELECT MEMBER_HOST FROM performance_schema.replication_group_members WHERE MEMBER_ROLE = 'PRIMARY')"
metrics:
- CLUSTER_NAME:
usage: "LABEL"
description: "Name of the cluster"
- INSTANCE_NAME:
usage: "LABEL"
description: "IP adress of the host"
- CHANNEL_NAME:
usage: "LABEL"
description: "The name of the Group Replication channel."
- MEMBER_ID:
usage: "LABEL"
description: "Shows the value of the name of the group. It is always a valid UUID."
- MEMBER_HOST:
usage: "LABEL"
description: "Hostname"
- MEMBER_PORT:
usage: "LABEL"
description: "Port"
- MEMBER_STATE:
usage: "LABEL"
description: "OFFLINE, ERROR, etc"
- MEMBER_ROLE:
usage: "LABEL"
description: "Primary or Secondary"
- MEMBER_VERSION:
usage: "LABEL"
description: "Version"
- MEMBER_STATE_UPDATE:
usage: "LABEL"
description: "OFFLINE, ERROR, etc UPDATED"
- STATUS:
usage: "GAUGE"
description: "Status in an interger value"
- ROLE:
usage: "GAUGE"
description: "Role in an interger value"

```

---

_[View the full topic](https://forums.percona.com/t/pmm2-custom-mysql-query-fail/7376)._
