我是 Prometheus 和 Micrometer 的新手。我试图在 JVM 的堆内存使用量超过某个阈值时发出警报。
- alert: P1 - Percentage of heap memory usage on environment more than 3% for 5 minutes.
expr: sum(jvm_memory_used_bytes{application="x", area="heap"})*100/sum(jvm_memory_max_bytes{application="x", area="heap"}) by (instance) > 3
for: 5m
labels:
priority: P1
tags: infrastructure, jvm, memory
annotations:
summary: "Percentage of heap memory is more than threshold"
description: "Percentage of heap memory for instance '{{ $labels.instance }}' has been more than 3% ({{ $value }}) for 5 minutes."
现在,当我在 Grafana 上使用此表达式时,此表达式正在起作用:
但是在 Prometheus 中是这样的:
当内存使用量超过某个限制时,如何让我的警报发出警报?