https://blog.csdn.net/natmazz/article/details/90581490
https://www.cnblogs.com/01-single/p/10602610.html
Zabbix monitoring mysql master-slave state and for alarm
First, environmental needs
Host A: zabbix-server
Host B: zabbix-agent / mysql from
Second, the operation of host B
1, add monitoring script
vim /data/zabbix/mysql_slave_check.sh #!/bin/bash #2019年03月26日16:25 #auto check mysql master and slave status #author dyw /usr/local/mysql/bin/mysql -uroot -p123456 -e "show slave status \G;" | grep -E 'Slave_IO_Running: Yes|Slave_SQL_Running: Yes' | grep -c Yes
2, add execute permissions
chmod +x /data/zabbix/mysql_slave_check.sh
3, configuration zabbix-agent profile
vim /etc/zabbix/zabbix_agentd.d/mysql_slave.conf UserParameter=mysql.ms.check,/data/zabbix/mysql_slave_check.sh
4, restart zabbix-agent
# service zabbix-agent restart Shutting down Zabbix agent: [ OK ] Starting Zabbix agent: [ OK ]
5, test
zabbix-server executing the command:
# zabbix_get -s 172.31.12.91 -k mysql.ms.check 2
Third, zabbix-server configuration
1, from the library to find the host, click on the monitored item
2, create a monitored item, key input agentd lower profile mysql_slave.conf the value in mysql.ms.check, input is completed, click the Add button below
3, create graphics
Enter a name, and then select the item you just added in the monitor monitored items, and finally click on the bottom of the Add button
After completing the look effects with graphics preview screen:
4, create a trigger, set email alert
Clicking the Add button, after the completion as shown:
5, the test, the trigger value to 3, and then click Update
Stop for a while there will be a warning message:
First, environmental needs
Host A: zabbix-server
Host B: zabbix-agent / mysql from
Second, the operation of host B
1, add monitoring script
vim /data/zabbix/mysql_slave_check.sh #!/bin/bash #2019年03月26日16:25 #auto check mysql master and slave status #author dyw /usr/local/mysql/bin/mysql -uroot -p123456 -e "show slave status \G;" | grep -E 'Slave_IO_Running: Yes|Slave_SQL_Running: Yes' | grep -c Yes
2, add execute permissions
chmod +x /data/zabbix/mysql_slave_check.sh
3, configuration zabbix-agent profile
vim /etc/zabbix/zabbix_agentd.d/mysql_slave.conf UserParameter=mysql.ms.check,/data/zabbix/mysql_slave_check.sh
4, restart zabbix-agent
# service zabbix-agent restart Shutting down Zabbix agent: [ OK ] Starting Zabbix agent: [ OK ]
5, test
zabbix-server executing the command:
# zabbix_get -s 172.31.12.91 -k mysql.ms.check 2
Third, zabbix-server configuration
1, from the library to find the host, click on the monitored item
2, create a monitored item, key input agentd lower profile mysql_slave.conf the value in mysql.ms.check, input is completed, click the Add button below
3, create graphics
Enter a name, and then select the item you just added in the monitor monitored items, and finally click on the bottom of the Add button
After completing the look effects with graphics preview screen:
4, create a trigger, set email alert
Clicking the Add button, after the completion as shown:
5, the test, the trigger value to 3, and then click Update
Stop for a while there will be a warning message: