# Watcher - webhook

**URL:** https://discuss.elastic.co/t/watcher-webhook/153353
**Category:** Elasticsearch
**Tags:** elastic-stack-alerting
**Created:** [October 22, 2018, 9:02am UTC](https://discuss.elastic.co/t/watcher-webhook/153353 "2018-10-22T09:02:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Kathir\_J](https://avatars.discourse-cdn.com/v4/letter/k/e47774/32.png) [@Kathir\_J](https://discuss.elastic.co/u/Kathir_J)
#### Post date: [October 22, 2018, 9:02am UTC](https://discuss.elastic.co/t/watcher-webhook/153353/1 "2018-10-22T09:02:59Z")

</div>

My watcher is not working when I simulate. Is there anything wrong here?  
I want to trigger restart from watcher using webhook.

Here is my watcher config.  
{  
"trigger": {  
"schedule": {  
"interval": "30m"  
}  
},  
"input": {  
"search": {  
"request": {  
"search\_type": "query\_then\_fetch",  
"indices": [  
"metricbeat\*"  
],  
"types": [],  
"body": {  
"size": 0,  
"query": {  
"match\_all": {}  
}  
}  
}  
}  
},  
"condition": {  
"compare": {  
"ctx.payload.hits.total": {  
"gte": 0  
}  
}  
},  
"actions": {  
"my\_webhook": {  
"webhook": {  
"scheme": "http",  
"host": "\*\*\*\*",  
"port": 8080,  
"method": "post",  
"path": "/cluster",  
"params": {},  
"headers": {  
"Content-Type": "application/json"  
},  
"body": "action:ROLLING\_START"  
}  
}  
}  
}

And the response is

{  
"watch\_id": "_inlined_",  
"node": "HYSGKmdtRdus44uBolCpuw",  
"state": "executed",  
"user": "elastic",  
"status": {  
"state": {  
"active": true,  
"timestamp": "2018-10-22T09:00:09.758Z"  
},  
"last\_checked": "2018-10-22T09:00:09.758Z",  
"last\_met\_condition": "2018-10-22T09:00:09.758Z",  
"actions": {  
"my\_webhook": {  
"ack": {  
"timestamp": "2018-10-22T09:00:09.758Z",  
"state": "ackable"  
},  
"last\_execution": {  
"timestamp": "2018-10-22T09:00:09.758Z",  
"successful": true  
},  
"last\_successful\_execution": {  
"timestamp": "2018-10-22T09:00:09.758Z",  
"successful": true  
}  
}  
},  
"execution\_state": "executed",  
"version": -1  
},  
"trigger\_event": {  
"type": "manual",  
"triggered\_time": "2018-10-22T09:00:09.758Z",  
"manual": {  
"schedule": {  
"scheduled\_time": "2018-10-22T09:00:09.758Z"  
}  
}  
},  
"input": {  
"search": {  
"request": {  
"search\_type": "query\_then\_fetch",  
"indices": [  
"metricbeat\*"  
],  
"types": [],  
"body": {  
"size": 0,  
"query": {  
"match\_all": {}  
}  
}  
}  
}  
},  
"condition": {  
"compare": {  
"ctx.payload.hits.total": {  
"gte": 0  
}  
}  
},  
"metadata": {  
"name": "Sample CM post http post",  
"xpack": {  
"type": "json"  
}  
},  
"result": {  
"execution\_time": "2018-10-22T09:00:09.758Z",  
"execution\_duration": 1,  
"input": {  
"type": "search",  
"status": "success",  
"payload": {  
"\_shards": {  
"total": 7,  
"failed": 0,  
"successful": 7,  
"skipped": 0  
},  
"hits": {  
"hits": [],  
"total": 80339,  
"max\_score": 0  
},  
"took": 0,  
"timed\_out": false  
},  
"search": {  
"request": {  
"search\_type": "query\_then\_fetch",  
"indices": [  
"metricbeat\*"  
],  
"types": [],  
"body": {  
"size": 0,  
"query": {  
"match\_all": {}  
}  
}  
}  
}  
},  
"condition": {  
"type": "compare",  
"status": "success",  
"met": true,  
"compare": {  
"resolved\_values": {  
"ctx.payload.hits.total": 80339  
}  
}  
},  
"actions": [  
{  
"id": "my\_webhook",  
"type": "webhook",  
"status": "simulated",  
"webhook": {  
"request": {  
"host": "\*\*\*\*\*",  
"port": 8080,  
"scheme": "http",  
"method": "post",  
"path": "/cluster",  
"headers": {  
"Content-Type": "application/json"  
},  
"body": "action:ROLLING\_START"  
}  
}  
}  
]  
},  
"messages": []  
}

---

<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: [October 22, 2018, 9:06am UTC](https://discuss.elastic.co/t/watcher-webhook/153353/2 "2018-10-22T09:06:21Z")

</div>

please take your time to use markdown and properly format a watch - this is nearly impossible to read. Thank you!

Also please take your time to properly formulate your problem instead of dumping a big chunk of JSON in here without any explanation. Can you please explain what you mean that your watch is not working? What is not working as expected? You explicitely chose the watch to be **simulated** which means, that the actions are not executed, but their execution is faked.

If you do not want to have this behaviour you can change it with in the execute watch API.

---

<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: [November 19, 2018, 9:07am UTC](https://discuss.elastic.co/t/watcher-webhook/153353/3 "2018-11-19T09:07:45Z")

</div>

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