Zabbix Monitor MySQL

MySQL monitoring, the template download address provided by the template provided by Percona’s official website:
https://www.percona.com/downloads/percona-monitoring-plugins/LATEST/

Percona Enterprises


wget https://downloads.percona.com/downloads/percona-monitoring-plugins/percona-monitoring-plugins-1.1.8/binary/redhat/7/x86_64/percona-zabbix-templates-1.1.8-1.noarch.rpm

rpm -ivh percona-zabbix-templates-1.1.8-1.noarch.rpm

Scripts are installed to /var/lib/zabbix/percona/scripts 
Templates are installed to /var/lib/zabbix/percona/templates 


mv /var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf /etc/zabbix/zabbix_agentd.d/


vi /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php
$mysql_user = 'zabbix';
$mysql_pass = '123456';


systemctl restart zabbix-agent.service


zabbix_get -s 127.0.0.1 -k MySQL.Open-files

Import an XML template

http://pan.baidu.com/s/1pL1wDYj

Relevant template collection data

[ , , (img-8SqMjC91-1614760084905)(C:\Users\Z\AppData\Roaming\Typora\typora-user-images\image-20210303162701943.png)]

I found another data running in MySQL running slave and permissions denied

[ , , (img-A8Vo1GKs-1614760679708)(C:\Users\Z\AppData\Roaming\Typora\typora-user-images\image-20210303163424501.png)]


vi /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh
RES=`HOME=~zabbix mysql -uroot -e 'SHOW SLAVE STATUS\G' | egrep '(Slave_IO_Running|Slave_SQL_Running):' | awk -F: '{print $2}' | tr '\n' ','`

It’s okay if the main database will be tracked for data

Link: https://oldqiang.com/archives/213.html

Leave a Comment