smtp - Splunk sendemail 使用邮件服务器 smtp.gmail.com 失败 [Errno 99]
问题描述
来自/opt/splunk/var/log/splunk/python.log
:
2018-11-12 14:29:08,776 +0000 ERROR sendemail:137 - Sending email. subject="Splunk Alert: Errors in develop", results_link="https://localhost:8000/app/search/@go?sid=rt_scheduler__admin__search__RMD58e26482826eced90_at_1542024571_26.426", recipients="[u'my_email@gmail.com']", server="localhost"
2018-11-12 14:29:08,776 +0000 ERROR sendemail:458 - [Errno 99] Cannot assign requested address while sending mail to: my_email@gmail.com
我的/opt/splunk/etc/system/local/alert_actions.conf
:
[email]
auth_password = XXX
auth_username = my_email@gmail.com
hostname = localhost
mailserver = smtp.gmail.com:465
pdf.header_left = none
pdf.header_right = none
use_ssl = 1
我也试过smtp.gmail.com:587
了use_ssl = 0 use_tls = 1
,在这两种情况下都有同样的错误。
但是,当尝试直接从搜索发送邮件时,它按预期工作:
... | sendemail to="my_email@gmail.com" format=raw sendresults=1 footer="Sent from Splunk." from="SplunkAlerts" subject="Splunk Alert" message="The following Splunk Alert has been fired:"
我缺少什么配置?errno 99 是 EADDRNOTAVAIL ,不清楚什么不可用,是server="localhost"
错误日志中的吗?我应该在哪里设置它?
解决方案
在您的配置中,您需要使用server=
,而不是mailserver
.
https://docs.splunk.com/Documentation/Splunk/7.2.0/SearchReference/Sendemail
请注意,Gmail 通常会很挑剔地尝试通过这种方式发送电子邮件,如果可能的话,我倾向于避免使用它。您是否配置了本地邮件服务器?
推荐阅读
- python-3.x - 在 Python 中使用 configparser 进行部分检查的问题
- bash - Bash:查找具有特定扩展名的所有文件并根据每个文件中的第一行内容重命名它们
- javascript - 如何为 IE11 正确使用 babel/corejs3/webpack?
- oracle - 为oracle sql中的两个不同列添加条件where子句
- javascript - 使用过渡更改 hr 数据内容的颜色
- c - 用C中的4个唯一随机数填充数组
- lua - 如何使lua搜索模块与首先调用require的模块位于同一文件夹中?
- php - 为什么不能为每个班级创建模拟?
- kubernetes - 如何在 GCP VM 中公开 minikube
- swift3 - 可以使用 URLSession swift 4 从 youtube 下载视频吗?