来自export PYTHONPATH=
:
/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
我缺少什么配置? errno 99是EADDRNOTAVAIL,不清楚什么不可用,它是错误日志中的... | 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:"
吗?我应该在哪里设置?
答案 0 :(得分:1)
在配置中,您需要使用server=
,而不是mailserver
。
https://docs.splunk.com/Documentation/Splunk/7.2.0/SearchReference/Sendemail
请注意,Gmail经常会试图通过这种方式发送电子邮件,所以我总是很挑剔,如果可能的话,我倾向于避免这样做。您是否配置了本地邮件服务器?
答案 1 :(得分:0)
与此同时,我正在使用以下脚本作为解决方法:
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
在$SPLUNK_HOME/bin/scripts/sendmail.sh