Created
December 16, 2019 18:54
-
-
Save dcvtruong/424b36b4322fddbc960760d6a5e283b5 to your computer and use it in GitHub Desktop.
Watcher JVM Heap Pct Usage
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
{ | |
"trigger": { | |
"schedule": { | |
"interval": "1440m" | |
} | |
}, | |
"input": { | |
"search": { | |
"request": { | |
"search_type": "query_then_fetch", | |
"indices": [ | |
".monitoring-es-7*" | |
], | |
"types": [ | |
"node_stats" | |
], | |
"rest_total_hits_as_int": true, | |
"body": { | |
"size": 0, | |
"query": { | |
"bool": { | |
"filter": [ | |
{ | |
"range": { | |
"timestamp": { | |
"gte": "now-30m", | |
"lte": "now" | |
} | |
} | |
} | |
] | |
} | |
}, | |
"aggs": { | |
"minutes": { | |
"date_histogram": { | |
"field": "timestamp", | |
"calendar_interval": "1h" | |
}, | |
"aggs": { | |
"nodes": { | |
"terms": { | |
"field": "source_node.name", | |
"size": 10 | |
}, | |
"aggs": { | |
"memory_over_25": { | |
"filters": { | |
"filters": { | |
"high": { | |
"range": { | |
"node_stats.jvm.mem.heap_used_percent": { | |
"gte": 5 | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"condition": { | |
"script": { | |
"source": "return ctx.payload.aggregations.minutes.buckets.stream().anyMatch(b -> b.nodes.buckets.stream().anyMatch(x -> x.memory_over_25.buckets.high.doc_count > 0))", | |
"lang": "painless" | |
} | |
}, | |
"actions": { | |
"log": { | |
"logging": { | |
"level": "info", | |
"text": "{{ctx.payload.hits.total.value}}" | |
} | |
} | |
}, | |
"throttle_period_in_millis": 86400000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment