[elk]elastalert邮箱告警
本次要完成以下任务:
- 1.源码包安装elasticalert
- 2.配置邮箱报警
原则: 先很快的通过alert报警发一份邮件,其次了解alert配置文件各个选项
源码安装elasticalert
参考:
http://elastalert.readthedocs.io/en/latest/running_elastalert.html
http://www.voidcn.com/article/p-mmtjbhjp-mm.html
https://github.com/Yelp/elastalert
已适合elasticsearch5.x
git clone https://github.com/Yelp/elastalert.git; cd elastalert
yum install gcc libffi-devel python-devel openssl-devel -y
pip install cryptography
pip install "setuptools>=11.3" ## 这里默认你已yum install python-pip并将源指向了aliyun.
python setup.py install
配置邮箱验证
- 配置邮箱用户名密码
$ cat /usr/local/elastalert/example_rules/email_auth.yaml
user: maotai@sina.com
password: 123456
- 修改配置alert配置文件
$ cat example_rules/rule.yaml
es_host: 192.168.x.x
es_port: 9200
name: For A TEST
use_strftine_index: true
type: frequency
index: filebeat-*
num_events: 1
timeframe:
hours: 1
#filter:
# - query:
# query_string:
# query: "@message: *nioEventLoopGroup*"
filter:
- query_string:
query: "message: 测试一下下"
alert:
- "email"
email:
- "maotai@qq.com"
- "maotai2@qq.com"
smtp_host: smtp.sina.com
smtp_port: 25
smtp_ssl: false
smtp_auth_file: /usr/local/elastalert/example_rules/email_auth.yaml
from_addr: maotai@sina.com
启动elasticalert测试
python -m elastalert.elastalert --verbose --rule example_rules/rule.yaml #启动后会自动创建一个elastalert_status的索引.
elk测试环境搭建
- 安装filebeat
- 安装es
- 配置filebeat
- 启动es,filebeat,elasticalert
参考:https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-overview.html
filebeat监控文件,并且向文件里写入内容
确保es能收到.在kibana里观察索引搜到的内容.
$ cat filebeat.yml
filebeat.prospectors:
- type: log
enabled: true
paths:
- /tmp/a.txt
output.elasticsearch:
hosts: ["http://192.168.x.x:9200"]
setup.dashboards.enabled: true
template.enabled: true
template.path: "filebeat.template.json"
template.overwrite: true
output.console:
pretty: true
dashboards.enabled: true
$ cat /tmp/a.txt
测试一下下
测试一下下
测试一下下
测试一下下
查看kibana

查看邮箱-已收到

alert还有kibana插件,以及elasticalert还可以容器方式启动
参考:
https://github.com/bitsensor/elastalert-kibana-plugin
插件下载慢:
https://git.bitsensor.io/front-end/elastalert-kibana-plugin/-/jobs/10874/artifacts/raw/artifact/elastalert-5.6.4-latest.zip
然后
./bin/kibana-plugin install file:///usr/local/src/elastalert-5.6.4-latest.zip
安装后效果:

微信报警:https://github.com/anjia0532/elastalert-wechat-plugin
钉钉报警:https://github.com/xuyaoqiang/elastalert-dingtalk-plugin
告警规则
告警模板
告警时间
告警方式
参考:https://xizhibei.github.io/2017/11/19/alerting-with-elastalert/
https://github.com/chenryn/ELKstack-guide-cn/blob/master/elasticsearch/other/elastalert.md
[elk]elastalert邮箱告警的更多相关文章
- 【ELK】elastalert 日志告警
一.环境 系统:centos7 elk 版本:7.6.2 1.1 ElastAlert 工作原理 周期性的查询Elastsearch并且将数据传递给规则类型,规则类型定义了需要查询哪些数据. 当一个规 ...
- Nagios 邮箱告警的方式太OUT了!
一般来讲,在安装完 Nagios 后,我们做的第一件最正确的事,就是设置它的邮件通知,对吧.因为如果没有这一步骤的话,你怎么能够知道什么时候会出现问题呢? 伴随着成功的初始安装,你即将是你司唯一一个能 ...
- Zabbix三种邮箱告警配置
环境 环境 IP地址 主机名 需要安装的应用 系统版本 服务端 192.168.23.140 zabbix lamp zabbix_server zabbix_agent CentOS 8 客户端 1 ...
- Zabbix邮箱告警
一.安装邮箱 yum install mailx 二.配置邮箱 vim /etc/mail.rc set from=875667601@qq.com set smtp=smtp.qq.com set ...
- zabbix使用邮箱告警
目的:使用自己的邮箱(目前我使用的是腾讯企业邮箱)发送告警邮件 1.配置Email:管理->报警媒介类型->Email->修改对应Email参数 2.修改admin用户的报警媒介Em ...
- ELK的sentinl告警配置详解
背景 sentinl的监控&告警是通过watch实现的. 一.Watch Execution 执行开始的时候, watcher为watch创建watch执行上下文. 执行上下文提供脚本和模板, ...
- 基于日志报警插件 elastalert 实现告警
1.官方http://elastalert.readthedocs.io/en/latest/ 2.报警规则示例 http://elastalert.readthedocs.io/en/latest/ ...
- Smokeping外置邮箱告警
wget http://xrl.us/cpanm -O /usr/bin/cpanm 1.安装Authen::SASL模块 cpanm --mirror http://mirrors.163.com/ ...
- 基于ELK进行邮箱访问日志的分析
公司希望能够搭建自己的日志分析系统.现在基于ELK的技术分析日志的公司越来越多,在此也记录一下我利用ELK搭建的日志分析系统. 系统搭建 系统主要是基于elasticsearch+logstash+f ...
随机推荐
- 通过pl/sql计算程序的运行时间
在sqlplus中运行sql语句或者pl/sql的时候如果需要统计运行的时间,只需要开启set timing on选项即可. SQL> set timing onSQL>SQL> s ...
- 【Rocket MQ】RocketMQ 在windows7 64位安装使用 +RocketMQ管理界面的安装
参考地址:https://blog.csdn.net/yucaifu1989/article/details/80960018 参考地址:https://blog.csdn.net/u01204090 ...
- 使用Gradle构建Android应用的渠道包
所有做Android App的同志们应该都知道渠道包是什么,得力于Android生态的多样性,我等写Android应用的人类每次发布App都需要面对数十个市场,而为了能够采集到市场的表现数据,就必须为 ...
- jquery的表单验证方法,一个function能不能同时捕捉点击事件和按键事件?能不能再优化下,有代码。
// 该jquery扩展引自 http://www.ghostsf.com/tools/389.html 方法名是作者博客的命名 $.fn.ghostsf_serialize = function ( ...
- Ubuntu下Firefox无法播放视频的解决方法
Ubuntu为Firefox安装Adobe Flash Player 解决方法(解决火狐浏览器安装了三个flash插件中的第二个或者第三个插件而无法安装第一个adobe flash插件的方法):在新立 ...
- JAVA HDFS API Client 连接HA
如果Hadoop开启HA,那么用Java Client连接Hive的时候,需要指定一些额外的参数 package cn.itacst.hadoop.hdfs; import java.io.FileI ...
- 服务器变量 超级全局数组$_SERVER (附加超简单表单与html5表单属性)
001.html <html> <head><title>user log</title> <meta http-equiv="cont ...
- ThinkPHP 3.2 中获取所有函数方法名,以及注释,完整可运行
<?php namespace Home\Controller; use Common\Controller\BaseController; class AuthController exten ...
- js 立即执行函数定义方法
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8&quo ...
- 解决树莓派新内核无法使用18B20和没有声音的问题
现在新版的树莓派内核由于为了兼容树莓派2和树莓派B+等以前的版本,采用了和原来不同的内核运行方式,使用了设备树的方式,更加灵活.但是由于可能不习惯这样的方式以及没太多相关这方面的介绍,导致很多用户更新 ...