Hello there,
Now the condition was met and the email was not sent out...
Please see the following and advise, thank you
{
"watch_id": "a724e8b2-3bd8-4c4c-b6bb-01b2548d77d4",
"node": "PSBN9nLqQe62KJmr1-oRMw",
"state": "executed",
"status": {
"state": {
"active": true,
"timestamp": "2018-10-04T22:42:24.066Z"
},
"last_checked": "2018-10-04T22:50:00.348Z",
"last_met_condition": "2018-10-04T22:50:00.348Z",
"actions": {
"email_1": {
"ack": {
"timestamp": "2018-10-04T22:42:24.066Z",
"state": "awaits_successful_execution"
},
"last_execution": {
"timestamp": "2018-10-04T22:50:00.348Z",
"successful": false,
"reason": ""
}
}
},
"execution_state": "executed",
"version": -1
},
"trigger_event": {
"type": "schedule",
"triggered_time": "2018-10-04T22:50:00.348Z",
"schedule": {
"scheduled_time": "2018-10-04T22:50:00.323Z"
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"metricbeat-"
],
"types": [],
"body": {
"size": 0,
"query": {
"bool": {
"filter": {
"range": {
"@timestamp": {
"gte": "{{ctx.trigger.scheduled_time}}||-5m",
"lte": "{{ctx.trigger.scheduled_time}}",
"format": "strict_date_optional_time||epoch_millis"
}
}
}
}
},
"aggs": {
"metricAgg": {
"max": {
"field": "system.filesystem.used.pct"
}
}
}
}
}
}
},
"condition": {
"script": {
"source": "if (ctx.payload.aggregations.metricAgg.value > params.threshold) { return true; } return false;",
"lang": "painless",
"params": {
"threshold": 0.3
}
}
},
"metadata": {
"name": "watcher-testing",
"watcherui": {
"trigger_interval_unit": "m",
"agg_type": "max",
"time_field": "@timestamp",
"trigger_interval_size": 1,
"term_size": 5,
"time_window_unit": "m",
"threshold_comparator": ">",
"term_field": null,
"index": [
"metricbeat-"
],
"time_window_size": 5,
"threshold": 0.3,
"agg_field": "system.filesystem.used.pct"
},
"xpack": {
"type": "threshold"
}
},
"result": {
"execution_time": "2018-10-04T22:50:00.348Z",
"execution_duration": 120079,
"input": {
"type": "search",
"status": "success",
"payload": {
"_shards": {
"total": 44,
"failed": 0,
"successful": 44,
"skipped": 0
},
"hits": {
"hits": [],
"total": 19352,
"max_score": 0
},
"took": 5,
"timed_out": false,
"aggregations": {
"metricAgg": {
"value": 0.988
}
}
},
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"metricbeat-*"
],
"types": [],
"body": {
"size": 0,
"query": {
"bool": {
"filter": {
"range": {
"@timestamp": {
"gte": "2018-10-04T22:50:00.323Z||-5m",
"lte": "2018-10-04T22:50:00.323Z",
"format": "strict_date_optional_time||epoch_millis"
}
}
}
}
},
"aggs": {
"metricAgg": {
"max": {
"field": "system.filesystem.used.pct"
}
}
}
}
}
}
},
"condition": {
"type": "script",
"status": "success",
"met": true
},
"transform": {
"type": "script",
"status": "success",
"payload": {
"result": 0.988
}
},
"actions": [
{
"id": "email_1",
"type": "email",
"status": "failure",
"error": {
"root_cause": [
{
"type": "messaging_exception",
"reason": "failed to send email with subject [Watch [watcher-testing] has exceeded the threshold] via account [ses_account]"
}
],
"type": "messaging_exception",
"reason": "failed to send email with subject [Watch [watcher-testing] has exceeded the threshold] via account [ses_account]",
"caused_by": {
"type": "mail_connect_exception",
"reason": "Couldn't connect to host, port: email-smtp.us-east-1.amazonaws.com, 25; timeout 120000",
"caused_by": {
"type": "socket_timeout_exception",
"reason": "connect timed out"
}
}
}
}
]
},
"messages": []
}