首页 > 解决方案 > 如何解决 elastalert 中的“连接到 SMTP 主机时出错”?

问题描述

我正在创建一个应用程序,我需要在其中触发特定事件的邮件。

当我运行以下命令时,

python -m elastalert.elastalert --verbose --rule myrules\myrule.yml

我得到错误

ERROR:root:Error while running alert email: Error connecting to SMTP host: [Error 10013] An attempt was made to access a socket in a way forbidden by its access permissions

这是我的规则文件的内容:

es_host: localhost
es_port: 9200
name: Log Level Test
type: frequency
index: testindexv4
num_events: 1
timeframe:
   hours: 4
filter:
 - term:
     log_level.keyword: "ERROR"
 - query:
     query_string:
       query: "log_level.keyword: ERROR"
alert:
- "email"
email:
- "<myMailId>@gmail.com"

这是 config.yaml 文件的内容

rules_folder: myrules
run_every:
  seconds: 2
buffer_time:
  seconds: 10
es_host: localhost
es_port: 9200
writeback_index: elastalert_status
alert_time_limit:
  days: 2

这是我的 smpt_auth 文件

alert:
 - email
email:
 - "<myMailId>@gmail.com"
smtp_host: "smtp.gmail.com" 
smtp_port: 465 
smtp_ssl: true
from_addr: "<otherMailId>@gmail.com"
smtp_auth_file: "smtp_auth_user.yaml"

这是 smtp_auth_user 文件的内容:

user: "<myMailId>@gmail.com"
password: "<password>"

我需要做出什么改变来解决这个问题?

标签: elasticsearchelastic-stackelastalert

解决方案


推荐阅读