使用percona|使用percona 插件监控mysql

一、下载插件rpm包
使用percona|使用percona 插件监控mysql
文章图片
image.png 二、安装rpm包,修改模板和conf文件信息

[root@zabbix-server ~]# rpm -ivh percona-zabbix-templates-1.1.8-1.noarch.rpm warning: percona-zabbix-templates-1.1.8-1.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY Preparing...################################# [100%] Updating / installing... 1:percona-zabbix-templates-1.1.8-1 ################################# [100%] Scripts are installed to /var/lib/zabbix/percona/scripts Templates are installed to /var/lib/zabbix/percona/templates [root@zabbix-server templates]# ll -rw-r--r-- 1 root root18866 Jan 102018 userparameter_percona_mysql.conf -rw-r--r-- 1 root root 269258 Jan 102018 zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.8.xml [root@zabbix-server templates]# vim userparameter_percona_mysql.conf UserParameter=MySQL.Open-files,/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh ij [root@zabbix-server templates]# sh -x /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh ij + ITEM=ij + HOST=localhost ++ dirname /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh + DIR=/var/lib/zabbix/percona/scripts + CMD='/usr/bin/php -q /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php --host localhost --items gg' + CACHEFILE=/tmp/localhost-mysql_cacti_stats.txt + '[' ij = running-slave ']' + '[' -e /tmp/localhost-mysql_cacti_stats.txt ']' ++ stat -c %Y /tmp/localhost-mysql_cacti_stats.txt + TIMEFLM=1565410214 ++ date +%s + TIMENOW=1565410481 ++ expr 1565410481 - 1565410214 + '[' 267 -gt 300 ']' + '[' -e /tmp/localhost-mysql_cacti_stats.txt ']' + awk -F: '{print $2}' + cat /tmp/localhost-mysql_cacti_stats.txt + sed 's/ /\n/g; s/-1/0/g' + grep ij [root@zabbix-server templates]# /usr/bin/php -q /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php --host localhost --items gg ERROR: Access denied for user 'cactiuser'@'localhost' (using password: YES) [root@zabbix-server templates]#vim /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php $mysql_user = 'zabbix'; $mysql_pass = '123456'; [root@zabbix-server templates]# /usr/bin/php -q /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php --host localhost --items gg gg:0 修改mysql主从: RES=`HOME=~zabbix mysql -uroot -e 'SHOW SLAVE STATUS\G' | egrep '(Slave_IO_Running|Slave_SQL_Running):' | awk -F: '{print $2}' | tr '\n' ','`

三、导入MySQL模板
使用percona|使用percona 插件监控mysql
文章图片
image.png 使用percona|使用percona 插件监控mysql
文章图片
image.png 四、链接模板
使用percona|使用percona 插件监控mysql
文章图片
image.png 【使用percona|使用percona 插件监控mysql】五、测试
使用percona|使用percona 插件监控mysql
文章图片
image.png

    推荐阅读