elastalert 用import属性来组织,引入配置
2024-08-24 04:34:42
对应rule的一些公用规则,可以放到一个或者多个头文件中。主的rule yaml文件引入即可。文件名随意,最好别用yaml后缀,要不会被当做一个rule。另外import在rule文件中只能出现一次。多个头文件的话可以import文件中引入另外一个import。
示例:
主的myrule.yaml:
import: inc_es.inc
name: hs_server_ahc_task system error type: frequency # (Required)
# Index to search, wildcard supported
index: hs_server_ahc_task* # (Required, frequency specific)
# Alert when this many documents matching the query occur within a timeframe
num_events: 1 # (Required, frequency specific)
# num_events must occur within this amount of time to trigger an alert
timeframe:
hours: 1 #import: inc_time_field.inc filter:
- terms:
"Level": ["fatal", "error"] alert_subject: "Alert: System {0} occurred {1} times."
alert_subject_args:
- Level
- "num_hits"
被import的 inc_es.inc 文件:
es_host: 10.10.21.77 # (Optional)
# Elasticsearch port
es_port: 9200 attach_related: true
use_kibana4_dashboard: https://nodejsgbl.italkbb.com/kibana/app/kibana#/dashboard/3bde48d0-9880-11e9-b5d5-2df46b09dea6 email_format: html import: inc_mail.inc
这个又引入 mail.inc
alert: - "email" email:
- "bin.zhi@net263.com"
#- "zhibingoo@163.com"
#- "fsha@net263.com"
#- "tiezhou.wei@net263.com" smtp_host: smtp.263.net
smtp_port: 25
smtp_auth_file: ../smtp_auth_file.yaml
email_reply_to: No.reply@net263.com
from_addr: ElastAlert@net263.com
#cc: bin.zhi@net263.com
运行:
elastalert --config ../config.yaml --rule hs_ahc_task.yaml --verbose --start 2019-06-27T08:45 --end 2019-06-27T09:55
最新文章
- Codeforces 144D Missile Silos 最短路
- jQuery 查找父元素
- 【BZOJ 1023】【SHOI 2008】cactus仙人掌图
- Ubuntu 系统密码相关问题
- netbean7.2 改变maven插件的中心库地址
- SQLite数据库在本地可以写,发布到服务器就不能写
- jsp导出Excel功能的实现
- jstl简介
- UVa 1346 - Songs
- Headfirst JSP 01 (概述)
- Android 性能优化——之控件的优化
- appium 环境搭建2
- .NetCore 资料分享
- linux journalctl 命令
- UML和模式应用4:初始阶段(3)--需求制品之用例模型
- SQL数据类型和C#数据类型间的转换
- 在Ubuntu中添加和删除PPA的软件源
- python基础24 -----python中的各种锁
- 【UML】UML类图关系(泛化 、继承、实现、依赖、关联、聚合、组合)
- HDU 1016 S-Nim ----SG求值
热门文章
- URI和URL的区别(转)
- MSAA简介
- Codeforces 1038 D. Slime
- vue单项数据流
- Content-type解析
- Gamma阶段第五次scrum meeting
- android中SELINUX规则分析和语法简介
- 解决vue项目路由出现message: ";Navigating to current location (XXX) is not allowed";的问题(点击多次跳转)
- Netty - PooledByteBufAllocator
- openssl 自己制作ssl证书:自己签发免费ssl证书,为nginx生成自签名ssl证书