Zabbix Monitor MySQL

MySQL monitoring, the template download address provided by the template provided by Percona’s official website:

Percona Enterprises


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 -k MySQL.Open-files

Import an XML template

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/
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


Leave a Comment