# Watcher condition failure

**URL:** https://discuss.elastic.co/t/watcher-condition-failure/69610
**Category:** Elasticsearch
**Tags:** elastic-stack-alerting
**Created:** [December 20, 2016, 7:08pm UTC](https://discuss.elastic.co/t/watcher-condition-failure/69610 "2016-12-20T19:08:29Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Akhilesh\_Anb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akhilesh_anb/32/4343_2.png) [@Akhilesh\_Anb](https://discuss.elastic.co/u/Akhilesh_Anb)
#### Post date: [December 20, 2016, 7:08pm UTC](https://discuss.elastic.co/t/watcher-condition-failure/69610/1 "2016-12-20T19:08:29Z")

</div>

I configured watcher configuration in elasticsearch.yml as follows

> #Watcher Configuration  
> watcher.actions.email.service.account:  
> exchange\_account:  
> profile: outlook  
> email\_defaults:  
> from: [abc@gmail.com](mailto:abc@gmail.com)  
> smtp:  
> auth: true  
> starttls.enable: true  
> host: [abc.com](http://abc.com)  
> port: 587  
> user: xxx  
> password: xxx

My condition for watcher is as follows

> {  
> "trigger" : {  
> "schedule" : { "interval" : "10s" }  
> },  
> "input" : {  
> "http" : {  
> "request" : {  
> "host" : "localhost",  
> "port" : 9200,  
> "path" : "/\_cluster/health",  
> "auth" : {  
> "basic" : {  
> "username" : "123",  
> "password" : "123"  
> }  
> }  
> }  
> }  
> },  
> "condition" : {  
> "compare" : {  
> "ctx.payload.status" : { "eq" : "yellow" }  
> }  
> },  
> "actions" : {  
> "send\_email" : {  
> "email" : {  
> "to" : "[abc@xxx.com](mailto:abc@xxx.com)",  
> "subject" : "ES Cluster Status Warning",  
> "body" : "The Cluster is down."  
> }  
> }  
> }  
> }

Im getting few errors. So now i changed the host and port number according to my requirement.  
Even after changing the host as [xyz.com](http://xyz.com) and port as 28 in elasticsearch.yml watcher condition is checking for the previous configuration.

> "reason": "MessagingException[failed to send email with subject [ES Cluster Status Warning] via account [exchange\_account]]; nested: MailConnectException[Couldn't connect to host, port: [abc.com](http://abc.com), 587; timeout 120000]; nested: ConnectException[Connection refused]; "

Help me.  
thank you

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [December 20, 2016, 9:29pm UTC](https://discuss.elastic.co/t/watcher-condition-failure/69610/2 "2016-12-20T21:29:20Z")

</div>

Hey,

please read the message of exception, which is telling you that the other side refused the network connection, when trying to sent the mail. This either means that there is no service listening (it is down, or you confused the host/port combination) or that it is potentially firewalled. This is not an issue with watcher, but with your setup of SMTP.

--Alex

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [January 17, 2017, 9:29pm UTC](https://discuss.elastic.co/t/watcher-condition-failure/69610/3 "2017-01-17T21:29:30Z")

</div>

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