既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上软件测试知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新
$ cd /app
$ git clone https://github.com/Yelp/elastalert.git
安装模块:
$ pip install “setuptools>=11.3”
$ python setup.py install
根据Elasticsearch的版本,您可能需要手动安装正确版本的elasticsearch-py。
Elasticsearch 5.0+:
$ pip install “elasticsearch>=5.0.0”
Elasticsearch 2.X:
$ pip install “elasticsearch<3.0.0”
## 3. 配置ElastAlert
配置config.yaml 文件
$ cp config.yaml.example config.yaml
$ cat config.yaml
rules_folder: example_rules
run_every:
seconds: 10
buffer_time:
minutes: 15
es_host: 10.1.144.208
es_port: 9201
#es_username: elastic
#es_password: 123456
writeback_index: elastalert_status
alert_time_limit:
days: 2
**rules\_folder**:ElastAlert从中加载规则配置文件的位置。它将尝试加载文件夹中的每个.yaml文件。没有任何有效规则,ElastAlert将无法启动。
**run\_every**: ElastAlert多久查询一次Elasticsearch的时间。
**buffer\_time**:查询窗口的大小,从运行每个查询的时间开始向后延伸。对于其中use\_count\_query或use\_terms\_query设置为true的规则,将忽略此值。
**es\_host**:是Elasticsearch群集的地址,ElastAlert将在其中存储有关其状态,查询运行,警报和错误的数据。
**es\_port**:es对应的端口。
**es\_username**: 可选的; 用于连接的basic-auth用户名es\_host。
**es\_password**: 可选的; 用于连接的basic-auth密码es\_host。
**es\_send\_get\_body\_as**: 可选的; 方法查询Elasticsearch - GET,POST或source。默认是GET
**writeback\_index**:ElastAlert将在其中存储数据的索引的名称。我们稍后将创建此索引。
**alert\_time\_limit**: 失败警报的重试窗口。
**创建elastalert-create-index索引**
$ elastalert-create-index
New index name (Default elastalert_status)
Name of existing index