Cant able to send mail from watcher

Hi All,

Iam trying to send alert mail from watcher but failed to send mail.
Iam using a gmail account.

This is the error message i gets from cluster log

[2020-04-22T02:20:37,420][ERROR][o.e.x.w.a.e.ExecutableEmailAction] [elk-master] failed to execute action [inlined/email_1]
javax.mail.MessagingException: failed to send email with subject [Watch [test] has exceeded the threshold] via account [gmail_account]
at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:171) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:163) ~[?:?]
at org.elasticsearch.xpack.watcher.actions.email.ExecutableEmailAction.execute(ExecutableEmailAction.java:76) ~[?:?]
at org.elasticsearch.xpack.core.watcher.actions.ActionWrapper.execute(ActionWrapper.java:164) [x-pack-core-7.6.2.jar:7.6.2]
at org.elasticsearch.xpack.watcher.execution.ExecutionService.executeInner(ExecutionService.java:534) [x-pack-watcher-7.6.2.jar:7.6.2]
at org.elasticsearch.xpack.watcher.execution.ExecutionService.execute(ExecutionService.java:320) [x-pack-watcher-7.6.2.jar:7.6.2]
at org.elasticsearch.xpack.watcher.transport.actions.execute.TransportExecuteWatchAction$1.doRun(TransportExecuteWatchAction.java:159) [x-pack-watcher-7.6.2.jar:7.6.2]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.xpack.watcher.execution.ExecutionService$WatchExecutionTask.run(ExecutionService.java:627) [x-pack-watcher-7.6.2.jar:7.6.2]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:633) [elasticsearch-7.6.2.jar:7.6.2]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:830) [?:?]
Caused by: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout 120000
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2209) ~[?:?]
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:722) ~[?:?]
at javax.mail.Service.connect(Service.java:342) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.Account.lambda$executeConnect$2(Account.java:161) ~[?:?]
at java.security.AccessController.doPrivileged(AccessController.java:554) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.Account.executeConnect(Account.java:160) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.Account.send(Account.java:119) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:169) ~[?:?]
... 12 more
Caused by: java.net.ConnectException: Connection refused
at sun.nio.ch.Net.pollConnect(Native Method) ~[?:?]
at sun.nio.ch.Net.pollConnectNow(Net.java:579) ~[?:?]
at sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549) ~[?:?]
at sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) ~[?:?]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:339) ~[?:?]
at java.net.Socket.connect(Socket.java:603) ~[?:?]
at com.sun.mail.util.WriteTimeoutSocket.connect(WriteTimeoutSocket.java:91) ~[?:?]
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:333) ~[?:?]
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:214) ~[?:?]
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2160) ~[?:?]
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:722) ~[?:?]
at javax.mail.Service.connect(Service.java:342) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.Account.lambda$executeConnect$2(Account.java:161) ~[?:?]
at java.security.AccessController.doPrivileged(AccessController.java:554) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.Account.executeConnect(Account.java:160) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.Account.send(Account.java:119) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:169) ~[?:?]
... 12 more

configuration file for elasticsearch

xpack.notification.email.account:
gmail_account:
profile: gmail
email_defaults:
from: raagurakesh765@gmail.com
smtp:
auth: true
starttls.enable: true
host: smtp.gmail.com
port: 587
user: gmail-id

password key stored using,

sudo ./elasticsearch-keystore add xpack.notification.email.account.my-gmail-id.smtp.secure_password

pls help. Is there anything missing from the configuration?....

Thanks in advance.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.