1.使用Percona监控插件监控MySQL

yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm

https://www.percona.com/doc/percona-monitoring-plugins/1.1/zabbix/index.html#installation-instructions

yum install percona-zabbix-templates php php-mysql

1.php脚本用来数据采集   2.shell  调用这个php   3.zabbix配置文件   4.zabbix模板文件      创建zabbix监控专用用户。

Percona Monitoring Plugins for Zabbix
These templates are mainly adopted from the existing Cacti ones. Currently, only MySQL template is available. There are a few major differences between Cacti and Zabbix templates: Zabbix does not support negative Y axis, that’s why you can see the negative values on some graphs to work out that - consider them the same as positive ones.
Zabbix does not support stacked graph items with mixed draw styles, that’s why some graphs may not look so nice like in Cacti as the stacks are replaced with lines.
Other Zabbix specific points: The items are populated by polling Zabbix agent.
There are predefined triggers available to use.
There is a screen as a placeholder for all graphs.
300 sec. polling interval - like with Cacti, the existing PHP script is used to retrive and cache MySQL metrics except some trigger-specific items. Due to the caching of results, PHP script runs only once per period.
System Requirements
Zabbix version 2.0.x. The actual testing has been done on the version 2.0.9.
Zabbix agent, php, php-mysql packages on monitored node.
Installation Instructions
Configure Zabbix Agent
Install the package from Percona Software Repositories: yum install percona-zabbix-templates
or: apt-get install percona-zabbix-templates
It will place files under /var/lib/zabbix/percona/. Alternatively, you can grab the tarball and copy folders zabbix/scripts/ and zabbix/templates/ into /var/lib/zabbix/percona/. See below for the URL.
Copy Zabbix Agent config: mkdir -p /etc/zabbix_agentd.conf.d/
cp /var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf /etc/zabbix_agentd.conf.d/userparameter_percona_mysql.conf
Ensure /etc/zabbix_agentd.conf contains the line: Include=/etc/zabbix_agentd.conf.d/
Restart Agent: service zabbix-agent restart
Configure MySQL connectivity on Agent
On this step we need to configure and verify MySQL connectivity with localhost on the Agent node. Create .cnf file /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php.cnf as described at configuration file Example: <?php
$mysql_user = 'root';
$mysql_pass = 's3cret';
Test the script: [root@centos6 main]# /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh gg
405647
Should return any number. If the password is wrong in .cnf file, you will get something like: [root@centos6 ~]# /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh gg
ERROR: run the command manually to investigate the problem: /usr/bin/php -q /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php --host localhost --items gg
[root@centos6 ~]# /usr/bin/php -q /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php --host localhost --items gg
ERROR: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)[root@centos6 ~]#
Configure ~zabbix/.my.cnf Example: [client]
user = root
password = s3cret
Test the script: [root@centos6 ~]# sudo -u zabbix -H /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh running-slave
0
Should return 0 or 1 but not the “Access denied” error.
Configure Zabbix Server
Grab the latest tarball from the Percona Software Downloads directory to your desktop.
Unpack it to get zabbix/templates/ folder.
Import the XML template using Zabbix UI (Configuration -> Templates -> Import) by additionally choosing “Screens”.
Create/edit hosts by assigning them “Percona Templates” group and linking the template “Percona MySQL Server Template” (Templates tab).
You are done.
Support Options
If you have questions, comments, or need help with the plugins, there are several options to consider. You can get self-service help via Percona’s forums, or the Percona mailing list. You can report bugs and submit patches to the Launchpad project.

最新文章

  1. sizeof、strlen、字符串、数组,整到一块,你还清楚吗?
  2. sublime配置coffeeScript
  3. 关于JQ的$.deferred函数。参考网络文档
  4. centos使用yum安装mysql
  5. PHP中Array关于数组的用法
  6. 10分钟学会基于ASP.NET的 JQuery实例 (转)
  7. [转]常用的130个vim命令
  8. MarkDown教程
  9. HDU 5889 Barricade 【BFS+最小割 网络流】(2016 ACM/ICPC Asia Regional Qingdao Online)
  10. C++学习之this指针
  11. FFT初解(转)
  12. MongoDB【第二篇】集群搭建
  13. 网络通信 --&gt; ZMQ安装和使用
  14. 利用adb安装apk
  15. LCS(最长公共子序列)问题
  16. mongodb 副本集部署
  17. c中extern的作用
  18. RuntimeError: Object: Could not open SDE workspace
  19. Oracle 快速插入1000万条数据的实现方式
  20. 题目:vbs批量开通工具,实现vbs开通的ux设计和流程调度

热门文章

  1. bzoj 5346: tree (其实是是某次雅礼集训的题)
  2. 【bzoj1085】【 [SCOI2005]骑士精神】启发式剪枝+迭代加深搜索
  3. RMQ小结
  4. [LOJ6277]数列分块入门 1
  5. 四. Java继承和多态10. Java Object类
  6. TDD的iOS开发初步以及Kiwi使用入门
  7. tshop-pbsm-shop-nav-ch结构和样式分析
  8. 转:如何查看MyEclipse包含的Eclipse的版本号
  9. 倍福TwinCAT(贝福Beckhoff)基础教程4.1 TwinCAT如何读写TXT文件
  10. java中native方法的使用