|
Percona Monitoring Plugins for Zabbix
由于zabbix自带的MySQL监控插件功能太过简陋,而且还没有提供可以直接使用的key,对于DBA来说,需要更加详细的监控数据,所以在生产场景中一般不使用自带的监控插件,而使用Percona公司的Percona Monitoring Plugins for Zabbix来监控MySQL。
官网地址:https://www.percona.com/doc/percona-monitoring-plugins/LATEST/zabbix/index.html
Percona公司有自己的一套数据库Percona Server,Percona Server在功能上和性能上较MySQL有着显著的提升,该版本提升了在高负载情况下的 InnoDB 的性能、为 DBA 提供一些非常有用的性能诊断工具;另外有更多的参数和命令来控制服务器行为,所以在监控MySQL性能参数方面就更加专业了。


MySQL监控几个重要的性能指标
· Slave_running 从库的运行状态
· Threads_running 数据库超负荷
· Aborted_clients 客户端被异常中断数值
· Questions 每秒钟获得的查询数量
· Handler_* 底层(low-level)数据库负载
· Opened_tables 表缓存没有命中的数量
· Slow_queries 慢查询数量
· show processlist 客户端连接进程数
· innodb status innodb状态:
· Pending normal aio reads 该值是innodb io请求查询的大小
· reads/s, avg bytes/read, writes/s, fsyncs/s 这些值是io统计
· Buffer pool hit rate 这个命中率非常依赖于你的应用程序
· inserts/s, updates/s, deletes/s, reads/s 有一些Innodb的底层操作
Percona Monitoring Plugins 安装
系统环境
[root@linux-node1 sbin]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@linux-node1 sbin]# ./zabbix_server -V
zabbix_server (Zabbix) 3.0.31)安装相关组件
[root@linux-node1 tools]# yum install php php-mysql -y
[root@linux-node1 tools]# wget https://www.percona.com/downloads/percona-monitoring-plugins/1.1.6/percona-zabbix-templates-1.1.6-1.noarch.rpm #下载percona的模板插件
[root@linux-node1 tools]# rpm -ivh percona-zabbix-templates-1.1.6-1.noarch.rpm
[root@linux-node1 tools]# rpm -ql percona-zabbix-templates #查看插件都安装了哪些文件在系统里面
/var/lib/zabbix/percona
/var/lib/zabbix/percona/scripts #scripts文件夹有一个脚本和一个php文件
/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh #脚本文件里面调用下面的php去连接数据库
/var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php
/var/lib/zabbix/percona/templates
/var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf #需要防止在zabbix_agentd.d/文件夹下的mysql监控脚本
/var/lib/zabbix/percona/templates/zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.6.xml
#这个是最后要导入到zabbix中去的模板文件 2)在agent上配置插件连接mysql数据库
[root@linux-node1 ~]# cd /var/lib/zabbix/percona/scripts
[root@linux-node1 scripts]# ll
total 64
-rwxr-xr-x 1 root root 1251 Jan 11 2016 get_mysql_stats_wrapper.sh
-rwxr-xr-x 1 root root 59640 Jan 11 2016 ss_get_mysql_stats.php
[root@linux-node1 scripts]# vim ss_get_mysql_stats.php.cnf #创建这个.cnf的文件 |
|
|