1、用戶端配置
[root@mysql zabbix_agentd.conf.d]# pwd
/usr/local/zabbix-server/etc/zabbix_agentd.conf.d
[root@mysql zabbix_agentd.conf.d]# cat custom_parameters.conf
UserParameter=masterha_manager,[ `/bin/ps aux | /bin/grep -v grep | /bin/grep -o masterha_manager` == masterha_manager ] &> /dev/null ;echo $?
UserParameter=crond,[ `/bin/ps aux | /bin/grep -v grep | /bin/grep -o crond` == crond ] &> /dev/null ;echo $?
UserParameter=postfix,[ `/bin/ps aux | /bin/grep -v grep | /bin/grep -o postfix` == postfix ] &> /dev/null ;echo $?
UserParameter=error,/usr/local/zabbix-server/error_log.sh
2、檢查日志關鍵字腳本
#!/bin/bash
msg=`tail -n 100 /var/log/secure | grep -iE "error" `
if [ ! -n "$msg" ];then
echo "OK"
exit 0
else
echo "error"
fi
3、zabbix 監控項和觸發器配置
監控項配置:

觸發器配置:
4、告警展示