PMM Monitoring MySQL
1. PMM-SERVER1. Install dockeryum install-y docker-io2. Pull pmm-server image docker pull percona/pmm-server:latest3. Create the persistence container docker create\-v / opt/prometheus/data\-v / opt/consul-data\-v / var/lib/mysql\-v / var/lib/grafana\-- name pmm-data\ percona/pmm-server:latest / bin/true4. Start pmm-serverdocker run-d\-p 8888name pmm-server 80\ # to map port 80 of docker to port 8888 of the host-- volumes-from pmm-data\-- name pmm-server\-- restart always\ percona/pmm-server:latest
View running status
[root@localhost ~] # docker ps-aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES983cb32aa7ca percona/pmm-server:latest "/ opt/entrypoint.sh" 4 days ago Up 4 days 443/tcp 0.0.0.0 8888-> 80/tcp pmm-server 670aaeb497cf percona/pmm-server:latest "/ bin/true" 4 days ago pmm-data 5. Turn off anonymous login And adjust the time zone [root@localhost docker] # docker exec-it pmm-server / bin/bash # to enter the docker container [root@983cb32aa7ca opt] # vi / etc/grafana/grafana.ini## Anonymous Auth # # [auth.anonymous] # enable anonymous access # enabled = True [root@983cb32aa7ca opt] # cat / etc/localtime TZif2UTCTZif2UTCUTC0 [root@983cb32aa7ca opt] # cp / usr/share/zoneinfo/Asia/Shanghai / etc/localtime cp: overwrite'/ etc/localtime'? Y6. Log in to dashboard
Enter: xx.xx.xx.xx:8888 in browser
2. PMM-CLIENT1. Install pmm-clientyum install http://www.percona.com/downloads/percona-release/redhat/0.1-6/percona-release-0.1-6.noarch.rpm # configure percona source yum install pmm-client # install pmm-client2 on the machine you need to monitor. Configure pmm-server addr
-- server is followed by the address and port of pmm-server
-c is followed by a configuration file, and the default configuration file is / usr/local/percona/pmm-client/pmm.yml
Pmm-admin config-- server xx.xx.xx.xx:8888-c / usr/local/percona/pmm-client/pmm.yml
The following is the contents of the configuration file
Cat / usr/local/percona/pmm-client/pmm.ymlserver_address: xx.xx.xx.xx:8888client_address: xx.xx.xx.xxbind_address: xx.xx.xx.xxclient_name: monitor-node13. Add linux system monitoring pmm-admin add linux:metrics 4. Add MySQL Monitoring
Create a monitoring user in the MySQL instance:
GRANT SELECT, PROCESS, SUPER, REPLICATION CLIENT, RELOAD ON *. * TO 'pmm'@'127.0.0.1' IDENTIFIED BY' pmm' WITH MAX_USER_CONNECTIONS 10 politics Grant SELECT, UPDATE, DELETE, DROP ON performance_schema.* TO 'pmm'@'127.0.0.1'
Add MySQL Monitoring
Pmm-admin add mysql-- host 127.0.0.1-- user pmm--password pmm--port 3306 instance3306 # # this command monitors the status of MySQL instances and slow query analysis. If you do not want to monitor slow logs, you can use mysql:metrics. 3. Problems encountered 1. Purge error
When a machine goes offline, you need to clean up the data about this machine in pmm-server, and report an error after executing the purge command.
[root@localhost ~] # pmm-admin purge linux:metricspanic: interface conversion: interface {} is nil, not Map [string] interface {} goroutine 1 [running]: github.com/percona/pmm-client/pmm. (* Admin) .PurgeMetrics (0xbe4e60, 0x7ffc82a0674b, 0xd, 0xc4201f68b8, 0xc4201abb68, 0x7ff262) / tmp/go/src/github.com/percona/pmm-client/pmm/main.go:427 + 0x5a4main.glob..func39 (0xbde460, 0xc4200a1730, 0x1 0x1) / tmp/go/src/github.com/percona/pmm-client/pmm-admin.go:1179 + 0xd1github.com/percona/pmm-client/vendor/github.com/spf13/cobra. (* Command) .execute (0xbde460, 0xc4200a16e0, 0x1, 0x1, 0xbde460, 0xc4200a16e0) / tmp/go/src/github.com/percona/pmm-client/vendor/github.com/spf13/cobra/command.go:654 + 0x2a2github.com/percona/pmm-client/vendor/github.com/spf13/cobra. (* Command) .ExecuteC (0xbdeb20, 0xc4201abdd0) 0x49b302, 0x0) / tmp/go/src/github.com/percona/pmm-client/vendor/github.com/spf13/cobra/command.go:729 + 0x2d4github.com/percona/pmm-client/vendor/github.com/spf13/cobra. (* Command) .Execute (0xbdeb20, 0xc0263c 0x92bf0f) / tmp/go/src/github.com/percona/pmm-client/vendor/github.com/spf13/cobra/command.go:688 + 0x2bmain.main () / tmp/go/src/github.com/percona/pmm-client/pmm-admin.go:1398 + 0x18dc
Suspected to be bug, the official table name will be fixed in a later version: https://jira.percona.com/browse/PMM-2894
2. _ PMM System Summary panel cannot display MySQL information summary
The error is as follows:
Server summary:mysql summary-Exit Status 1
Solution: soft connect MySQL related commands to / usr/bin/
Ln-s / usr/local/mysql/bin/* / usr/bin/
Reference address: https://www.percona.com/forums/questions-discussions/percona-monitoring-and-management/47268-server-summary-mysql-summary-exit-status-1