Last active
May 23, 2019 09:30
-
-
Save ilvar/8b030f8a3e7f9eb014bfab11b2debdec to your computer and use it in GitHub Desktop.
Create es watch (env name is parametrized)
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/ | |
{ | |
"trigger": { | |
"schedule": { | |
"interval": "10m" | |
} | |
}, | |
"input": { | |
"chain" : { | |
"inputs" : [ | |
{ | |
"vars" : { | |
"simple" : { "env" : "aylien-core-qa" } | |
} | |
}, | |
{ | |
"events" : { | |
"search": { | |
"request": { | |
"body": { | |
"size": 0, | |
"query": { | |
"bool": { | |
"filter": [ | |
{ | |
"match": { | |
"cloud.project.id.keyword": "{{ctx.payload.vars.env}}" | |
} | |
}, | |
{ | |
"range": { | |
"@timestamp": { | |
"gte": "now-24h" | |
} | |
} | |
}, | |
{ | |
"match": { | |
"newsapi_sidekiqAdmin_json.action": "indexed_clusters" | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
}}}]} | |
}, | |
"condition": { | |
"compare" : { | |
"ctx.payload.events.hits.total" : { | |
"eq" : 0 | |
} | |
} | |
}, | |
"actions": { | |
"slack-notify": { | |
"throttle_period" : "4h", | |
"slack": { | |
"message": { | |
"to": [ | |
"#core-alert" | |
], | |
"text": "No saved clusters in the last 4 hours for environment {{ctx.payload.vars.env}}" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment