1. 程式人生 > >使用percona mysql插件來監控mysql5.7

使用percona mysql插件來監控mysql5.7

cacti 5.7 cat upload php -s my.cnf load 監控

1、安裝 php

yum install -y php php-mysql

2、安裝 percona-zabbix

yum install -y https://www.percona.com/downloads/percona-monitoring-plugins/percona-monitoring-plugins-1.1.7/binary/redhat/7/x86_64/percona-zabbix-templates-1.1.7-2.noarch.rpm

3、配置 zabbix agentd

vim /usr/local/zabbix/etc/zabbix_agentd.conf
  Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/*.conf
cd /var/lib/zabbix/percona/templates
cp userparameter_percona_mysql.conf /usr/local/zabbix/etc/zabbix_agentd.conf.d/
killall -9 zabbix_agentd
chown zabbix.zabbix /tmp/localhost-mysql_cacti_stats.txt

4、配置 MySQL 默認登陸賬號

su - zabbix
cat .my.cnf
  [client]
  password=MySQL2018
  user=root

5、修改 php 腳本

cd /var/lib/zabbix/percona/scripts/
vim ss_get_mysql_stats.php 
  $mysql_user = ‘root‘;
  $mysql_pass = ‘MySQL2018‘;
  $mysql_port = 3306;
  $mysql_socket = ‘/tmp/mysql.sock‘;

6、測試獲取 MySQL 數據

cd /var/lib/zabbix/percona/scripts/
/usr/bin/php ss_get_mysql_stats.php --host localhost --items gg
cd /usr/local/zabbix/bin
./zabbix_get -s 172.16.2.39 -k MySQL.file-reads

7、下載模板導入到 zabbix
https://www.ttlsa.com/wp-content/uploads/2016/07/Percona-MySQL-Server-Template.zip
參考文檔:
Download Percona Monitoring Plugins
zabbix3.0.2 使用percona mysql插件來監控mysql5.7的詳細實現過程
zabbix-3.0導入percona模板報錯

使用percona mysql插件來監控mysql5.7