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": []
}