Splunk sendemail无法通过邮件服务器smtp.gmail.com发送[Errno 99]

Splunk sendemail无法通过邮件服务器smtp.gmail.com发送[Errno 99],smtp,splunk,mail-server,Smtp,Splunk,Mail Server,从/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__RMD58e264828

/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\u 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\u ssl=0 use\u 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


请注意,Gmail通常会对通过这种方式发送电子邮件很挑剔,如果可能的话,我倾向于避免使用这种方式。您是否配置了本地邮件服务器?

目前,我使用以下脚本作为解决方案:

temp="/tmp/results_$(date -u +%s).csv"
gunzip < $8 > $temp
printf "$1 alarming logs were found by $4\n$6" | \
  SMTP_URL='smtps://my_email%40gmail.com:password@smtp.gmail.com' mutt \
  -F /dev/null \
  -e 'set from="Splunk <my_email@gmail.com>"' \
  -e 'set smtp_url=$SMTP_URL' \
  -s "Splunk: $4" \
  -a $temp --  \
  target@gmail.com
rm -rf $temp
temp=“/tmp/results_$(日期-u+%s).csv”
gunzip<$8>$temp
printf“$4\n$6发现$1报警日志”|\
SMTP_URL='1〕smtps://my_email%40gmail.com:password@smtp.gmail.com'mutt\
-F/dev/null\
-e'设置自=“Splunk”'\
-e'设置smtp\u url=$smtp\u url'\
-s“Splunk:$4”\
-一个$temp--\
target@gmail.com
rm-rf$temp

$SPLUNK\u HOME/bin/scripts/sendmail.sh

中,配置由SPLUNK web生成。。无论如何,当手动编辑它并添加
server=smtp.gmail.com:465
时,它仍然会在错误日志中显示
localhost
。请参阅此处发布的解决方案,我没有任何本地
savedsearchs.conf
,也不会在每个警报的配置中定义
[savedsearch name]
,除非有一些自动生成,否则实际上更好的解决方法是编辑
/opt/splunk/etc/apps/search/bin/sendmail.py
的内容,但不确定配置中的内容是否被正确读取