1, write the monitoring master-slave shell script check_mysql_replication.sh, put under/etc/zabbix/
#!/bin/bash
/usr/bin/mysql-uzabbix-p password-e ' show slave status\g ' |grep-e "slave_io_running| Slave_sql_running "|awk ' {print $} ' |grep-c Yes
2. Authorizing Zabbix users from the library:
Grant replication Client on * * to ' zabbix ' @ ' localhost ' identified by ' password ';
3, edit/etc/zabbix/zabbix-agentd.conf, add the following content
userparameter=mysql.slavestatus,/etc/zabbix/mysql_replication_check.sh
Note: After the addition of the zabbix-server can be tested in the following command:
Zabbix_get-s 10.1.1.6-k Mysql.slavestatus
4. Specify host to add Iteams\triggers on Zabbix-server server
Iteams Add the following:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/73/B0/wKiom1YD0_HSvtEzAALBnsAKX4c599.jpg "title=" Iteams.png "alt=" Wkiom1yd0_hsvtezaalbnsakx4c599.jpg "/>
5, trigger add as follows:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/73/B0/wKiom1YD1DGRMc6lAAGGmcZSt0M757.jpg "title=" Trigger.png "alt=" Wkiom1yd1dgrmc6laaggmczst0m757.jpg "/>
Zabbix monitor MySQL master and slave