MySQL监控工具PMM分享

PMM(Percona Monitoring and Management)是一个免费的开源平台,用于管理和监视数据库性能,在Docker环境中即可运行 。它可以主动管理和监控MySQL(AWS RDS MySQL、Aurora MySQL、用户自建MySQL实例)、MariaDB、MongoDB、PostgreSQL等数据库,也可以监控ProxySQL中间件,并提供了众多指标与多样告警方式 。
Percona Monitoring and Management (PMM)是一款开源的用于管理和监控MySQL和MongoDB性能的开源平台,通过PMM客户端收集到的DB监控数据用第三方软件Grafana画图展示出来 。
PMM提供了对MyISAM、InnoDB、TokuDB和PXC/Glarera的监控,另外也提供了Query Analytics的功能,可以检视执行了哪些SQL指令,并对执行效能较差的语法进行优化 。另外在新版本还支持了MySQL复制拓扑图结构构造 。Demo官网:
http://pmmdemo.percona.com
PMM针对操作系统的部份也提供了硬盘、网络、CPU和RAM的监控,特别的是它提供了Context switches、Processes和interrupts的监控,Context Switches可以看到CPU上下切换文的状况,Processes可以方便了解系统有多少程序在等待I/O 。
PMM整体来说算是一款不错的监控产品,针对MySQL、PG、Mongo都有很专业的指标统计,而且部署简单整套打包到容器中 。2.0之后底层持久化数据库从MySQL更换为PG后,性能更是有很大提升 。
整体架构图

MySQL监控工具PMM分享

文章插图
 
server端组件介绍
  • uery Analytics (QAN) enables you to analyze MySQL query performance over periods of time. In addition to the client-side QAN agent, it includes the following:QAN API is the back-end for storing and accessing query data collected by the QAN agent running on a PMM Client.QAN Web App is a web application for visualizing collected Query Analytics data.
  • Metrics Monitor provides a historical view of metrics that are critical to a MySQL or MongoDB server instance. It includes the following:
  • VictoriaMetrics, a scalable time-series database. (Replaced Prometheus in PMM 2.12.0.)
  • ClickHouse is a third-party column-oriented database that facilitates the Query Analytics functionality.
  • Grafana is a third-party dashboard and graph builder for visualizing data aggregated (by VictoriaMetrics or Prometheus) in an intuitive web interface.
  • Percona Dashboards is a set of dashboards for Grafana developed by us.
Agent端架构
MySQL监控工具PMM分享

文章插图
 
PMM客户端和服务端整体结构
MySQL监控工具PMM分享

文章插图
 
agent端组件介绍
The PMM Client package consist of the following:
  • pmm-admin is a command-line tool for managing PMM Client, for example, adding and removing database instances that you want to monitor. (Read more).
  • pmm-agent is a client-side component a minimal command-line interface, which is a central entry point in charge for bringing the client functionality: it carries on client’s authentication, gets the client configuration stored on the PMM Server, manages exporters and other agents.
  • node_exporter is an exporter that collects general system metrics.
  • mysqld_exporter is an exporter that collects MySQL server metrics.
  • mongodb_exporter is an exporter that collects MongoDB server metrics.
  • postgres_exporter is an exporter that collects PostgreSQL performance metrics.
  • proxysql_exporter is an exporter that collects ProxySQL performance metrics.
  • rds_exporter is an exporter that collects Amazon RDS performance metrics.
  • azure_database_exporter is an exporter that collects Azure database performance metrics.
 
安装使用官网:
https://www.percona.com/software/pmm/quickstart#awsrds
安装server端:10.10.119.651 docker create -v /srv --name pmm-data percona/pmm-server:2 /bin/true2 docker run -d -p 280:80 -p 1443:443 --volumes-from pmm-data --name pmm-server --restart always percona/pmm-server:2添加agent:10.10.119.64yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpmyum install pmm2-client配置agent[root@localhost ~]# pmm-admin config --server-insecure-tls --server-url=https://admin:admin@10.10.119.65:1443Checking local pmm-agent status...pmm-agent is running.Registering pmm-agent on PMM Server...Registered.Configuration file /usr/local/percona/pmm2/config/pmm-agent.yaml updated.Reloading pmm-agent configuration...Configuration reloaded.Checking local pmm-agent status...pmm-agent is running.


推荐阅读