zabbix监控MySQL
2016-06-22 11:37
561 查看
通过使用mysql_performance_monitor软件包实现zabbix对mysql的监控。
1.安装依赖软件。
yum install perl-File-Which perl-libwww-perl perl-Digest-SHA perl-DBD-MySQL perl-Time-HiRes perl-Crypt-SSLeay php php-mysql
2.下载mysql_performance_monitor软件包。
wget -c http://www.shinguz.ch/download/mysql_performance_monitor-latest.tar.gz tar xf mysql_performance_monitor-latest.tar.gz
3.安装percona-monitor-templates软件包。
[root@DB ~]# rpm -ihv https://www.percona.com/downloads/percona-monitoring-plugins/1.1.5/percona-zabbix-templates-1.1.5-1.noarch.rpm Retrieving https://www.percona.com/downloads/percona-monitoring-plugins/1.1.5/percona-zabbix-templates-1.1.5-1.noarch.rpm warning: /var/tmp/rpm-tmp.P8evAy: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing... ########################################### [100%]
1:percona-zabbix-template########################################### [100%]
Scripts are installed to /var/lib/zabbix/percona/scripts
Templates are installed to /var/lib/zabbix/percona/templates
4.查看percona-zabbix-templates软件包生成目录文件位置。
[root@DB ~]# rpm -ql percona-zabbix-templates
/var/lib/zabbix/percona
/var/lib/zabbix/percona/scripts
/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh
/var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php
/var/lib/zabbix/percona/templates
/var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf
/var/lib/zabbix/percona/templates/zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.5.xml
5.拷贝配置文件userparameter_percona_mysql.conf到zabbix配置文件目录下。
[root@DB ~]# cp /var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf /etc/zabbix/zabbix_agentd.d/
6.重新启动zabbix-agent服务。
[root@DB ~]# /etc/init.d/zabbix-agent restart
Shutting down Zabbix agent: [ OK ]
Starting Zabbix agent: [ OK ]
7.修改连接数据库的用户名和密码
[root@DB ~]# grep -A 1 root /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php
$mysql_user = 'user_name';
$mysql_pass = 'password';
8.测试。
[root@DB ~]# /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh gg
2
如果没有数据,请执行如下操作,查看/etc/php.ini中MySQL的sock配置文件位置是否正确。
/usr/bin/php -q /var/lib/zabbix/percona/scripts/ss_get_mystats.php --host localhost --items gg
通过报错信息排查错误。
1.安装依赖软件。
yum install perl-File-Which perl-libwww-perl perl-Digest-SHA perl-DBD-MySQL perl-Time-HiRes perl-Crypt-SSLeay php php-mysql
2.下载mysql_performance_monitor软件包。
wget -c http://www.shinguz.ch/download/mysql_performance_monitor-latest.tar.gz tar xf mysql_performance_monitor-latest.tar.gz
3.安装percona-monitor-templates软件包。
[root@DB ~]# rpm -ihv https://www.percona.com/downloads/percona-monitoring-plugins/1.1.5/percona-zabbix-templates-1.1.5-1.noarch.rpm Retrieving https://www.percona.com/downloads/percona-monitoring-plugins/1.1.5/percona-zabbix-templates-1.1.5-1.noarch.rpm warning: /var/tmp/rpm-tmp.P8evAy: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing... ########################################### [100%]
1:percona-zabbix-template########################################### [100%]
Scripts are installed to /var/lib/zabbix/percona/scripts
Templates are installed to /var/lib/zabbix/percona/templates
4.查看percona-zabbix-templates软件包生成目录文件位置。
[root@DB ~]# rpm -ql percona-zabbix-templates
/var/lib/zabbix/percona
/var/lib/zabbix/percona/scripts
/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh
/var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php
/var/lib/zabbix/percona/templates
/var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf
/var/lib/zabbix/percona/templates/zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.5.xml
5.拷贝配置文件userparameter_percona_mysql.conf到zabbix配置文件目录下。
[root@DB ~]# cp /var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf /etc/zabbix/zabbix_agentd.d/
6.重新启动zabbix-agent服务。
[root@DB ~]# /etc/init.d/zabbix-agent restart
Shutting down Zabbix agent: [ OK ]
Starting Zabbix agent: [ OK ]
7.修改连接数据库的用户名和密码
[root@DB ~]# grep -A 1 root /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php
$mysql_user = 'user_name';
$mysql_pass = 'password';
8.测试。
[root@DB ~]# /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh gg
2
如果没有数据,请执行如下操作,查看/etc/php.ini中MySQL的sock配置文件位置是否正确。
/usr/bin/php -q /var/lib/zabbix/percona/scripts/ss_get_mystats.php --host localhost --items gg
通过报错信息排查错误。
相关文章推荐
- win7 中使用PLSQL Developer(不需安装oracle)
- 用sqldevelop进行连接linux中ret Hat 6.2 中的oracle步骤
- MySQL-- 每半月一个分区,自动维护
- 使用mysql_ping解决mysql报错:"MySQL server has gone away"
- 浅谈PetShop之使用存储过程与PLSQL批量处理(附案例)
- MySQL数据库的优化(下)MySQL数据库的高可用架构方案
- 32位 PL/SQL Develope r如何连接64位的Oracle 图解
- MySQL性能调优与架构设计——第 14 章 可扩展性设计之数据切分
- MySQL内存体系架构及参数总结 ---图解
- MySQL server has gone away 问题
- mysql高可用集群——MHA架构
- 【DataBase】64位操作系统适配32位PLSQL Developer
- MSSQL中利用TOP提高IF EXISTS查询语句的性能
- 跟踪监控MYSQL执行的sql语句
- CentOS Linux中MySQL自动备份及FTP远程备份
- -- Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.
- 关于SQLNET.ORA中的参数SQLNET.ALLOWED_LOGON_VERSION
- [转]PL/SQL Developer 导入导出csv文件
- mysql维护管理常用指令
- mysql的LOOP, LEAVE 和ITERATE语句