java.lang.IllegalArgumentException: no accounts of type [email] configured. Please set up an account using the [xpack.notification.email] settings

I followed Email Action | X-Pack for the Elastic Stack [6.2] | Elastic, yet keep getting following error:

esd4 | [2018-03-13T19:24:15,542][ERROR][o.e.x.w.a.e.ExecutableEmailAction] [esd4] failed to execute action [WDuSnqbkQbinQ5vLtLpqag_elasticsearch_cluster_status/send_email_to_admin]
esd4 | java.lang.IllegalArgumentException: no accounts of type [email] configured. Please set up an account using the [xpack.notification.email] settings

my email account settings are:

xpack.notification.email.account.gmail.profile=gmail
xpack.notification.email.account.gmail.smtp.user=X
xpack.notification.email.account.gmail.smtp.password=X

Please advise.

Configured the gmail account set up in elasticsearch.yml and allowed 2 step verification for it.

xpack.notification:
   email.account.gmail_account:
       smtp:
            auth: true
            starttls.enable: true
            host: smtp.gmail.com
            port: 587
            user: xxx@gmail.com
            password: xxxxxx

This config worked for me on 6.2 and I do receive emails via watcher email action. Can you please verify your config?

Thanks
Rashmi

Common sources of mistakes here:

First, is this configuration of all of your nodes.
Second, did you restart all your nodes after applying this change?

If you do not fancy restarts and do not want to store these settings in the yaml file, you can also use the cluster update settings API to add a new email account. This also has the advantage, that it gets distributed to all nodes without you having to do anything.

I saw following in logs:

esd4             | [2018-03-16T18:29:58,318][ERROR][o.e.x.w.a.e.ExecutableEmailAction] [esd4] failed to execute action [WDuSnqbkQbinQ5vLtLpqag_elasticsearch_nodes/send_email_to_admin]
esd4             | javax.mail.MessagingException: failed to send email with subject [X-Pack Monitoring: Nodes Changed (WDuSnqbkQbinQ5vLtLpqag)] via account [gmail_account]
esd4             | 	at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:112) ~[?:?]
esd4             | 	at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:104) ~[?:?]
esd4             | 	at org.elasticsearch.xpack.watcher.actions.email.ExecutableEmailAction.execute(ExecutableEmailAction.java:84) ~[?:?]
esd4             | 	at org.elasticsearch.xpack.core.watcher.actions.ActionWrapper.execute(ActionWrapper.java:156) ~[x-pack-core-6.2.2.jar:6.2.2]
esd4             | 	at org.elasticsearch.xpack.watcher.execution.ExecutionService.executeInner(ExecutionService.java:492) ~[x-pack-watcher-6.2.2.jar:6.2.2]
esd4             | 	at org.elasticsearch.xpack.watcher.execution.ExecutionService.execute(ExecutionService.java:322) ~[x-pack-watcher-6.2.2.jar:6.2.2]
esd4             | 	at org.elasticsearch.xpack.watcher.execution.ExecutionService.lambda$executeAsync$7(ExecutionService.java:426) ~[x-pack-watcher-6.2.2.jar:6.2.2]
esd4             | 	at org.elasticsearch.xpack.watcher.execution.ExecutionService$WatchExecutionTask.run(ExecutionService.java:580) [x-pack-watcher-6.2.2.jar:6.2.2]
esd4             | 	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:573) [elasticsearch-6.2.2.jar:6.2.2]
esd4             | 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_161]
esd4             | 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_161]
esd4             | 	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_161]
esd4             | Caused by: javax.mail.AuthenticationFailedException: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbtX
esd4             | 534-5.7.14 NsungKoIYLSu6BRWb1zr4FZU9tzbKYSqiPZPznda9k_KbJc5OfPs5UMvB3QIIXaBrR-oYf
esd4             | 534-5.7.14 1qI-VtUumWZkZlZYAwnEu2_oLgTAN_1BaiNwm5apFh4lYIOluOe79ZsAsNpbWoWNBAMa13
esd4             | 534-5.7.14 YnaJ5mMwCNSaA8G6WXWddyCLOWJlWPBC_5IwYj5MVTKQ9R4ALmv6ezbooFlsqTMGjV4Nbn
esd4             | 534-5.7.14 n5rs5SKh-2m7Fv-on7S9MlAyYaLRU> Please log in via your web browser and
esd4             | 534-5.7.14 then try again.
esd4             | 534-5.7.14  Learn more at
esd4             | 534 5.7.14  https://support.google.com/mail/answer/78754 x10sm844763ual.46 - gsmtp
esd4             | 
esd4             | 	at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:932) ~[?:?]
esd4             | 	at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:843) ~[?:?]
esd4             | 	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:748) ~[?:?]
esd4             | 	at javax.mail.Service.connect(Service.java:366) ~[?:?]
esd4             | 	at org.elasticsearch.xpack.watcher.notification.email.Account.lambda$executeConnect$2(Account.java:166) ~[?:?]
esd4             | 	at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_161]
esd4             | 	at org.elasticsearch.xpack.watcher.notification.email.Account.executeConnect(Account.java:165) ~[?:?]
esd4             | 	at org.elasticsearch.xpack.watcher.notification.email.Account.send(Account.java:124) ~[?:?]
esd4             | 	at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:110) ~[?:?]
esd4             | 	... 11 more

So this means that your accounts are setup properly in x-pack. This message comes from google and also contains a link that explains the steps you need to do in order to set up this up properly on the google side.

Is there a way to figure out which node(s) is/are miss-configured? As when I try to create new watch via Kibana, under action I see grey out message:

E-mail
Disabled. Configure elasticsearch.yml

you might want to check the node kibana connects to first in this case.

ha! you were right, I did all nodes, but coordinate node and now that I update it, it shows up as it should)

Thanks!

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