Percona Monitoring and Management (PMM) 是用于管理和监控 MySQL 和 MongoDB 性能的开源平台,通过 PMM 客户端收集到的 DB 监控数据用第三方软件 Grafana 展示出来。下文为测试环境安装配置 PMM。
PMM Server 版本:1.10.0
操作系统版本:CentOS 6.7 x86_64
PMM Server 安装 PMM Server 提供两种安装介质,一种是 DOCKER 镜像,一种是 OVF 镜像文件。在这里我选择使用 VirtualBox 虚拟机安装 PMM Server。下载 OVF 镜像文件 后,使用 VirtualBox 导入镜像文件启动虚拟机;在浏览器中打开虚拟机显示的访问地址,设置用户名与密码完成配置;至此 PMM Server 安装完成。
注意:导入 OVF 镜像文件时需要重置 MAC 地址;网络连接方式选择桥接网卡;
系统用户:root 密码:percona
PMM client 安装 使用 yum 方式安装客户端
1 2 yum install http://www.percona.com/downloads/perconarelease/redhat/0.1-4/perconarelease-0.1-4.noarch.rpm yum -y install pmm-client
PMM client 配置 PMM client 连接 PMM Server,此次需要输入在浏览器中设置的用户名、密码。
1 2 3 4 5 6 [root@pmm_client ~] OK, PMM server is alive. PMM Server | 10.1.1.1 (password-protected) Client Name | pmm_client Client Address | 10.1.1.2
添加监控项,此处需要使用到 MySQL 用户信息。
注意 PMM server 根据不同监控要求,要打开 42000、42001、42002 端口。
1 2 3 4 5 [root@pmm_client ~] OK, now monitoring this system. [root@pmm_client ~] OK, now monitoring MySQL metrics using DSN pmm:***@unix(/var/lib/mysql/mysql.sock)
查看监控情况
1 2 3 4 5 6 7 8 9 10 11 12 13 [root@pmm_client ~] pmm-admin 1.10.0 PMM Server | 10.1.1.1 (password-protected) Client Name | pmm_client Client Address | 10.1.1.2 Service Manager | linux-upstart -------------- ----------------- ----------- -------- ------------------------------------- -------- SERVICE TYPE NAME LOCAL PORT RUNNING DATA SOURCE OPTIONS -------------- ----------------- ----------- -------- ------------------------------------- -------- linux:metrics pmm_client 42000 YES - mysql:metrics pmm_client 42002 YES pmm:***@unix(/mysql/data/mysql.sock)
查看网络连接情况
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 [root@pmm_client ~] PMM Network Status Server Address | 10.1.1.1 Client Address | 10.1.1.2 * System Time NTP Server (0.pool.ntp.org) | 2018-05-23 11:34:49 +0800 CST PMM Server | 2018-05-23 03:34:49 +0000 GMT PMM Client | 2018-05-23 11:34:50 +0800 CST PMM Server Time Drift | OK PMM Client Time Drift | OK PMM Client to PMM Server Time Drift | OK * Connection: Client --> Server -------------------- ------- SERVER SERVICE STATUS -------------------- ------- Consul API OK Prometheus API OK Query Analytics API DOWN Connection duration | 411.068µs Request duration | 10.429001ms Full round trip | 10.840069ms * Connection: Client <-- Server -------------- ----------------- ------------------ ------- ---------- --------- SERVICE TYPE NAME REMOTE ENDPOINT STATUS HTTPS/TLS PASSWORD -------------- ----------------- ------------------ ------- ---------- --------- linux:metrics pmm_client 10.1.1.2:42000 OK YES YES mysql:metrics pmm_client 10.1.1.2:42002 OK YES YES
PMM 详细的监控配置,会记录在后续文章。
参考