我刚打酱油去了,不好意思

kibana使用watch功能,无法发送预警邮件

Kibana | 作者 json_111 | 发布于2019年04月09日 | 阅读数:5010

es版本 6.5.1
kibana 版本 6.5.1
已经配置了X-pack,并且使用正常
今天按照官网测试kibana的watch功能,在elasticserch.yml文件中配置了邮件信息,配置如下:
xpack.notification.email.account:
    outlook_account:
        profile: outlook
        smtp:
            auth: true
            starttls.enable: true
            host: smtp-mail.outlook.com
            port: 587
            user: *******@hotmail.com
            password: ******
重启es服务,之后在kibana页面可以看到action那可以选择发送邮件,但是测试发送邮件的过程中显示
falied send to ***@126.com  报错日志如下:

[2019-04-09T18:18:52,443][ERROR][o.e.x.w.t.s.ExecutableScriptTransform] [yh_elk_online] failed to execute [script] transform for [bMOmgNFVR7WJFicup-iXwQ_elasticsearch_cluster_status_9d849fed-731f-46e1-a4fa-a1c247594cca-2019-04-09T10:18:52.434Z]
org.elasticsearch.script.ScriptException: runtime error
at org.elasticsearch.painless.PainlessScript.convertToScriptException(PainlessScript.java:94) ~[?:?]
at org.elasticsearch.painless.PainlessScript$Script.execute(ctx.vars.email_recipient = (ctx.payload.kibana_settings.hits.total > 0 && ctx.payload.kibana_settings.hits.hits[0]._source.kibana_settings.xpack != null) ? ctx.payload.kibana_settings.hits.hits[0]._source.kibana_settings.xpack.default_admin_email : null;ct ...:1152) ~[?:?]
at org.elasticsearch.xpack.watcher.transform.script.ExecutableScriptTransform.doExecute(ExecutableScriptTransform.java:49) ~[x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.xpack.watcher.transform.script.ExecutableScriptTransform.execute(ExecutableScriptTransform.java:38) ~[x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.xpack.watcher.transform.script.ExecutableScriptTransform.execute(ExecutableScriptTransform.java:23) ~[x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.xpack.watcher.execution.ExecutionService.executeInner(ExecutionService.java:444) ~[x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.xpack.watcher.execution.ExecutionService.execute(ExecutionService.java:295) ~[x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.xpack.watcher.execution.ExecutionService.lambda$executeAsync$5(ExecutionService.java:395) ~[x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.xpack.watcher.execution.ExecutionService$WatchExecutionTask.run(ExecutionService.java:544) [x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:624) [elasticsearch-6.5.1.jar:6.5.1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_201]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_201]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:657) ~[?:1.8.0_201]
at java.util.ArrayList.get(ArrayList.java:433) ~[?:1.8.0_201]
at org.elasticsearch.painless.PainlessScript$Script.execute(ctx.vars.email_recipient = (ctx.payload.kibana_settings.hits.total > 0 && ctx.payload.kibana_settings.hits.hits[0]._source.kibana_settings.xpack != null) ? ctx.payload.kibana_settings.hits.hits[0]._source.kibana_settings.xpack.default_admin_email : null;ct ...:429) ~[?:?]
... 11 more
[2019-04-09T18:19:52,458][ERROR][o.e.x.w.t.s.ExecutableScriptTransform] [yh_elk_online] failed to execute [script] transform for [bMOmgNFVR7WJFicup-iXwQ_elasticsearch_cluster_status_0654fcff-9378-4eeb-a81d-4ed82c173813-2019-04-09T10:19:52.451Z]
org.elasticsearch.script.ScriptException: runtime error
at org.elasticsearch.painless.PainlessScript.convertToScriptException(PainlessScript.java:94) ~[?:?]
at org.elasticsearch.painless.PainlessScript$Script.execute(ctx.vars.email_recipient = (ctx.payload.kibana_settings.hits.total > 0 && ctx.payload.kibana_settings.hits.hits[0]._source.kibana_settings.xpack != null) ? ctx.payload.kibana_settings.hits.hits[0]._source.kibana_settings.xpack.default_admin_email : null;ct ...:1152) ~[?:?]
at org.elasticsearch.xpack.watcher.transform.script.ExecutableScriptTransform.doExecute(ExecutableScriptTransform.java:49) ~[x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.xpack.watcher.transform.script.ExecutableScriptTransform.execute(ExecutableScriptTransform.java:38) ~[x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.xpack.watcher.transform.script.ExecutableScriptTransform.execute(ExecutableScriptTransform.java:23) ~[x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.xpack.watcher.execution.ExecutionService.executeInner(ExecutionService.java:444) ~[x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.xpack.watcher.execution.ExecutionService.execute(ExecutionService.java:295) ~[x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.xpack.watcher.execution.ExecutionService.lambda$executeAsync$5(ExecutionService.java:395) ~[x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.xpack.watcher.execution.ExecutionService$WatchExecutionTask.run(ExecutionService.java:544) [x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:624) [elasticsearch-6.5.1.jar:6.5.1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_201]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_201]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:657) ~[?:1.8.0_201]
at java.util.ArrayList.get(ArrayList.java:433) ~[?:1.8.0_201]
at org.elasticsearch.painless.PainlessScript$Script.execute(ctx.vars.email_recipient = (ctx.payload.kibana_settings.hits.total > 0 && ctx.payload.kibana_settings.hits.hits[0]._source.kibana_settings.xpack != null) ? ctx.payload.kibana_settings.hits.hits[0]._source.kibana_settings.xpack.default_admin_email : null;ct ...:429) ~[?:?]
... 11 more
[2019-04-09T18:20:06,738][ERROR][o.e.x.w.a.e.ExecutableEmailAction] [yh_elk_online] failed to execute action [_inlined_/email_1]
javax.mail.MessagingException: failed to send email with subject [登录测试预警] via account [outlook_account]
at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:153) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:145) ~[?:?]
at org.elasticsearch.xpack.watcher.actions.email.ExecutableEmailAction.execute(ExecutableEmailAction.java:72) ~[?:?]
at org.elasticsearch.xpack.core.watcher.actions.ActionWrapper.execute(ActionWrapper.java:144) [x-pack-core-6.5.1.jar:?]
at org.elasticsearch.xpack.watcher.execution.ExecutionService.executeInner(ExecutionService.java:455) [x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.xpack.watcher.execution.ExecutionService.execute(ExecutionService.java:295) [x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.xpack.watcher.transport.actions.execute.TransportExecuteWatchAction$1.doRun(TransportExecuteWatchAction.java:154) [x-pack-watcher-6.5.1.jar:6.5.1]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.5.1.jar:6.5.1]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_201]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_201]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:624) [elasticsearch-6.5.1.jar:6.5.1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_201]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_201]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
Caused by: com.sun.mail.smtp.SMTPSendFailedException: 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 16.55847:A2030000, 17.43559:0000000094000000000000000000000000000000, 20.52176:140FEB8600004010F1030000, 20.50032:140FEB8670174010F1030000, 0.35180:D6100000, 255.23226:00000000, 255.27962:0A000000, 255.27962:0E000000, 255.31418:140FEB86, 16.55847:88000000, 17.43559:0000000070010000000000000200000000000000, 20.52176:140FEB860000F01F0A000000, 20.50032:140FEB8670170011900F0000, 0.35180:00000000, 255.23226:00000000, 255.27962:0A000000, 255.27962:32000000, 255.17082:DC040000, 0.27745:140FEB86, 4.21921:DC040000, 255.27962:FA000000, 255.1494:64000000, 0.38698:00000000, 0.37692:01000000, 0.37948:05000780, 5.33852:00000000534D545000010480, 4.56248:DC040000, 7.40748:010000000000010B0A000000, 7.57132:0000000000000000614F22AA, 1.63016:32000000, 4.39640:DC040000, 8.45434:00400600AFEB3EE9000000000000000030303A48, 5.10786:0000000031352E32302E313737312E3030303A484B32505230314D42333333303A34383964373461662D646439342D343239312D393432322D62393263373364383461646400101008000100, 255.1750:A0000000, 255.31418:0A005636, 0.22753:A5000000, 255.21817:DC040000, 4.60547:DC040000, 0.21966:03003866, 4.30158:DC040000 [Hostname=HK2PR01MB3330.apcprd01.prod.exchangelabs.com]
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2358) ~[?:?]
at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:2110) ~[?:?]
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1316) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.Account.send(Account.java:141) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:151) ~[?:?]
... 13 more


我并未使用第三方插件,而是使用kibana自带的watch模块在测试,请问是那里出了问题?
 
已邀请:

laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net

赞同来自:

看报错是执行脚本的错误,你从这个排查一下。

要回复问题请先登录注册