zabbix 监控日志关键字
1、客户端配置
# pwd
/usr/local/zabbix-server/etc/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"
exit 0
fi
3、zabbix监控项和触发器配置
监控项配置:
https://s5.运维网.com/wyfs02/M01/9B/B1/wKiom1ll6sqAqJ_-AAA-MWeantI960.png-wh_500x0-wm_3-wmp_4-s_897429864.png
触发器配置:
https://s2.运维网.com/wyfs02/M02/9B/B1/wKiom1ll6pKRG2jmAABuiJIFwOk356.png-wh_500x0-wm_3-wmp_4-s_1714392407.png
4、告警展示
https://s5.运维网.com/wyfs02/M01/9B/B1/wKioL1ll60egnqdkAAAbegWaGk8223.png-wh_500x0-wm_3-wmp_4-s_1058758948.png
6666666
页:
[1]