Error executing Watcher Email Action

I'm having trouble with a watch action that executes an email on a single node cluster that works just fine on other clusters (all version 2.1.2)

The action looks like this

   "actions":{
      "send_email_notification":{
         "throttle_period":"1d",
         "email":{
            "to":[  "myemail@myemail.com" ],
            "subject":"{{ctx.metadata.email_subject}}",
            "body": "HELLO"
            }
        }
   }

I know the watch itself is ok because I can create and execute it on a different cluster and it works

On the offending cluster I can see the default account being set

[2017-02-20 21:00:10,366][INFO ][watcher.actions.email.service] [master-node-1] default account set to [watcheremail]

my watcher configuration from the elasticsearch.yml looks like this

watcher.actions.email.sanitize_html: false
watcher.actions.email.html.sanitization.enabled: false

watcher.actions.email.service.account:
  watcheremail:
    email_defaults:
      from: 'Log Watcher <noreply@mmm.com>'
    smtp:
      host: [my smtp hostname]
      port: 25

but when the watch action is triggered I get this in the action result

  "actions" : [ {
    "id" : "send_email_notification",
    "type" : "email",
    "status" : "failure",
    "reason" : "NullPointerException[null]"
  } ]

and this in the trace log. Rebuilding the cluster is not an option anyone would be happy about.

[2017-02-20 21:00:59,886][ERROR][watcher.actions.email ] [master-node-1] failed to execute action [filetransferservice_error_status/email_somebody]
java.lang.NullPointerException
at org.elasticsearch.watcher.actions.email.service.Account.send(Account.java:85)
at org.elasticsearch.watcher.actions.email.service.InternalEmailService.send(InternalEmailService.java:83)
at org.elasticsearch.watcher.actions.email.service.InternalEmailService.send(InternalEmailService.java:77)
at org.elasticsearch.watcher.actions.email.ExecutableEmailAction.execute(ExecutableEmailAction.java:67)
at org.elasticsearch.watcher.actions.ActionWrapper.execute(ActionWrapper.java:106)
at org.elasticsearch.watcher.execution.ExecutionService.executeInner(ExecutionService.java:388)
at org.elasticsearch.watcher.execution.ExecutionService.execute(ExecutionService.java:273)
at org.elasticsearch.watcher.transport.actions.execute.TransportExecuteWatchAction.masterOperation(TransportExecuteWatchAction.java:130)
at org.elasticsearch.watcher.transport.actions.execute.TransportExecuteWatchAction.masterOperation(TransportExecuteWatchAction.java:61)
at org.elasticsearch.action.support.master.TransportMasterNodeAction$3.doRun(TransportMasterNodeAction.java:130)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

Hey,

is it possible that localhost does not resolve properly in your linux setup? Can you try and add a static entry to the /etc/hosts file, if resolving has issues?

--Alex

The actual value in the elasticsearch.yml file is pointing to a functioning corporate smtp server. It works from another cluster so that's not it.

host: [my smtp hostname]

I did add an entry to the hosts file but no change.

Hey,

just to be sure on my side: Resolving also works for localhost, independently of your SMTP configuration?

Also, any changes in the hosts file will require a restart of your node.

--Alex

Yes

ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=255 time=0.014 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=255 time=0.024 ms

Hey,

interesting, so far we only found this exception on Linux systems with resolving issues. One last thing you can try out would be to also add localhost.localdomain to the hosts list.

Apart from that, this is fixed in newer versions of watcher, so if you upgrade to the latest, this issue should be gone as well, without requiring/changing any of your setup.

Would love go get to the ground of this anyway to be honest. Will try to think, how to debug this further.

--Alex

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