1. Use zabbix + Shell scripts to monitor Mysql master-slave replication. An alarm is triggered when an exception occurs in the slave database.
1.1 first authorize a monitoring account to mysql slave.
1.2 compile a script to monitor the slave database status. Use show slave status to view the slave database status. If two Yes values are displayed at the same time, the slave database is normal, otherwise, various exceptions may occur in the slave database.
1.3 Add the following content to the zabbix_agentd configuration file of the database:
Mysql. replication indicates the key value, and/etc/zabbix/replication_status.sh indicates the absolute path for storing the script.
1.4 restart the zabbix_agentd service from data.
1.4 run zabbix_get on the zabbix server to check whether the status value from data monitoring can be obtained.
1.5 configure the monitoring entry Items for mysql master-slave monitoring.
1.6 configure the Trigger for mysql master-slave monitoring, that is, an alarm is triggered when the collected status value is less than 2.
1.7 test: if you stop the mysql service of the primary database or slave stop on the slave database, zabbix will trigger an alarm.
2. Use zabbix + Shell scripts to monitor host survival and generate an alarm when the host is down.