the system activity dashboard use $host variable.(see pic)
but our mysql:metrics name is not same as linux:metrics name and it is not $host
It seems that pmm have not considered the scenario of multiple instances.
we use the ip of the linux:metrics name, and use ip_port as the mysql:metrics name
- name: Adding MySQL services to monitoring
shell: >
if ! pmm-admin list | grep {{ item | quote }} | {{ pmm_client_db[‘mysql’][‘socket’] | quote }} ; then
pmm-admin add {{ item | quote }}
–user {{ pmm_client_db[‘mysql’][‘username’] | quote }}
–password {{ pmm_client_db[‘mysql’][‘password’] | quote }}
–socket {{ pmm_client_db[‘mysql’][‘socket’] | quote }}
–disable-tablestats {{ ansible_em2[‘ipv4’][‘address’] }}_{{ pmm_client_db[‘mysql’][‘port’] }} ; fi
no_log: True
when: (‘mysql’ in item)
with_items: “{{ pmm_client_add_services }}”
pmm-admin list
pmm-admin 1.17.1
PMM Server | 192.168.x.143:8080 (password-protected)
Client Name | 192.168.x.180
Client Address | 192.168.x.180
Service Manager | linux-systemd
SERVICE TYPE NAME LOCAL PORT RUNNING DATA SOURCE OPTIONS
mysql:queries 192.168.x.180_3306 - YES pmm:@unix(/data/mysql_3306/tmp/mysql.sock) query_source=slowlog, query_examples=true, slow_log_rotation=true, retain_slow_logs=1
mysql:queries 192.168.x.180_3307 - YES pmm:@unix(/data/mysql_3307/tmp/mysql.sock) query_source=slowlog, query_examples=true, slow_log_rotation=true, retain_slow_logs=1
mysql:queries 192.168.x.180_3308 - YES pmm:@unix(/data/mysql_3308/tmp/mysql.sock) query_source=slowlog, query_examples=true, slow_log_rotation=true, retain_slow_logs=1
linux:metrics 192.168.x.180 42000 YES -
mysql:metrics 192.168.x.180_3308 42002 YES pmm:@unix(/data/mysql_3308/tmp/mysql.sock) tablestats=OFF
mysql:metrics 192.168.x.180_3307 42003 YES pmm:@unix(/data/mysql_3307/tmp/mysql.sock) tablestats=OFF
mysql:metrics 192.168.x.180_3306 42004 YES pmm:@unix(/data/mysql_3306/tmp/mysql.sock) tablestats=OFF