-
-
Save jeffeDivert/7b213ae9683dc2b18c5686a50c99790c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUT _watcher/watch/heartbeat_test_018 | |
{ | |
"trigger" : { | |
"schedule" : { | |
"interval" : "30s" | |
} | |
}, | |
"input" : { | |
"search" : { | |
"request" : { | |
"indices" : "hbtest03", | |
"body" : { | |
"size" : 0, | |
"aggs" : { | |
"lastheartbeat" : { | |
"terms" : { | |
"field" : "device_no" | |
}, | |
"aggs" : { | |
"recent_beats" : { | |
"top_hits" : { | |
"size" : 1, | |
"sort" : [ | |
{ | |
"sql_time" : { | |
"order" : "desc" | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"condition" : { | |
"array_compare": { | |
"ctx.payload.aggregations.lastheartbeat.buckets" : { | |
"path": "recent_beats.hits.hits.0._source.sql_time", | |
"lte": { | |
"value": "<{now-1d}>", | |
"quantifier": "some" | |
} | |
} | |
} | |
}, | |
"actions" : { | |
"reminder_email" : { | |
"email" : { | |
"to" : "jedwards@divertinc.com", | |
"subject" : "Watcher Alert", | |
"body" : "Test alert body. Heartbeats have stopped from one or more devices!" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment