zabbix 监控 etl 日志 告警

2018年6月28日 0 条评论 672 次阅读 1 人点赞

zabbix 监控 etl 日志 告警

效果

当执行etl出现错误的时候,发出告警邮件通知

1530181076257839.png

恢复邮件通知:

QQ截图20180628181909.png

环境

  • data-integration:基于linux下使用java执行的etl程序

  • zabbix:监控日志报警

zabbix设置

监控项

QQ截图20180628181026.png

键值内容如下:(根据实际修改)

logrt["/opt/etl/ems-etl_hunan/log/^daily_mv_update_[0-9]{8}\.log$",".*Kitchen.*Finished.*",skip,]

触发器

QQ截图20180628181134.png

告警表达式  修改  如下:

{1.1.1.1:logrt["/opt/etl/ems-etl_hunan/log/^daily_mv_update_[0-9]{8}\.log$",".*Kitchen.*Finished.*",skip,].str(Finished with errors)}=1 or {1.1.1.1:logrt["/opt/etl/ems-etl_hunan/log/^daily_mv_update_[0-9]{8}\.log$",".*Kitchen.*Finished.*",skip,].count(25h,Finished!)}=0

恢复表达式  修改  如下:

{1.1.1.1:logrt["/opt/etl/ems-etl_hunan/log/^daily_mv_update_[0-9]{8}\.log$",".*Kitchen.*Finished.*",skip,].count(1h,Finished with errors)}=0 and {1.1.1.1:logrt["/opt/etl/ems-etl_hunan/log/^daily_mv_update_[0-9]{8}\.log$",".*Kitchen.*Finished.*",skip,].count(1h,Finished!)}>0

额外

用于测试告警的shell如下:

#设置
val=13;rm -rf daily_mv_update_20180628.log ;
echo $RANDOM > daily_mv_update_20180628.log ;
cat daily_mv_update_201806$val.log >> daily_mv_update_20180628.log ;
echo '2018/06/07 18:13:09 - Kitchen - ERROR (version 6.1.0.1-196, build 1 from 2016-04-07 12.08.49 by buildguy) : Finished with errors' >>daily_mv_update_20180628.log

#解除
val=14;rm -rf daily_mv_update_20180629.log ;
echo $RANDOM > daily_mv_update_20180629.log ;
cat daily_mv_update_201806$val.log >> daily_mv_update_20180629.log

参考的告警表达式&恢复表达式如下:

{1.1.1.1:logrt["/opt/etl/ems-etl_hunan/log/^daily_mv_update_[0-9]{8}\.log$",".*Kitchen.*Finished.*",skip,].count(1h,Finished with errors)}=0 and {1.1.1.1:logrt["/opt/etl/ems-etl_hunan/log/^daily_mv_update_[0-9]{8}\.log$",".*Kitchen.*Finished.*",skip,].count(24h,Finished!)}=0

{1.1.1.1:logrt["/opt/etl/ems-etl_hunan/log/^daily_mv_update_[0-9]{8}\.log$",".*Kitchen.*Finished.*",skip,].str(Finished with errors)}=1 or {1.1.1.1:logrt["/opt/etl/ems-etl_hunan/log/^daily_mv_update_[0-9]{8}\.log$",".*Kitchen.*Finished.*",skip,].nodata(24h)}=0

{1.1.1.1:logrt["/opt/etl/ems-etl_hunan/log/^daily_mv_update_[0-9]{8}\.log$",".*Kitchen.*Finished.*",skip,].str(Finished with errors,1h)}=0 and {1.1.1.1:logrt["/opt/etl/ems-etl_hunan/log/^daily_mv_update_[0-9]{8}\.log$",".*Kitchen.*Finished.*",skip,].str(Finished!,1h)}=1

Sevenfal

这个人太懒什么东西都没留下

文章评论(0)