Adding Variable for Group Replication member role in the dashboard

We have configured PMM 2.37.0.

In the MySQL Overview dashboard, I need to add a muli-select variable with query like below for the node role in the group replication environment:

select MEMBER_ROLE from performance_schema.replication_group_members

Hi Farhan,

You may use the next query:
label_values(mysql_perf_schema_replication_group_member_info, member_role)

Hello @Vadim_Yalovets ,
Thanks for the reply, your query is giving me the results but I want to segregate the member_role as per below:

label_values(mysql_up{region=~“$region”,environment=~“$environment”,cluster=~“$cluster”,replication_set=~“$replication_set”}, mysql_perf_schema_replication_group_member_info, member_role)

please let me know how I can do this?

Please try the next one:

label_values(mysql_perf_schema_replication_group_member_info{region=~"$region",environment=~"$environment",cluster=~"$cluster",replication_set=~"$replication_set"}, member_role)

its giving me the results but its not filtering the nodes on previous variable/s selection.

like if I select region as Asia, Environment as QA, cluster as QAHRCluster then I want member_role either SELECT Primary or Secondary should display only the selected node’s graphs.

You may change service_name variable to use mysql_perf_schema_replication_group_member_info metric instead of mysql_up

label_values(mysql_perf_schema_replication_group_member_info{region=~“$region”,environment=~“$environment”,cluster=~“$cluster”,replication_set=~“$replication_set”,node_name=~“$node_name”,member_role=~“$member_role”}, service_name)

Screenshot 2023-08-14 at 11.41.00

Screenshot 2023-08-14 at 11.41.31

Hello @Vadim_Yalovets ,

can we do it with Node name variable? as I have made it hide this Service Name variable.

Hi Farhad,

Yes, it can be done. The metric has got node_name parameter.

e.g.