首页 > 代码库 > zabbix 监控日志关键字
zabbix 监控日志关键字
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"
exit 0
fi
3、zabbix 监控项和触发器配置
监控项配置:
触发器配置:
4、告警展示
本文出自 “天道酬勤” 博客,请务必保留此出处http://4543647.blog.51cto.com/4533647/1946796
zabbix 监控日志关键字