小编Ser*_*vko的帖子

如何在警报规则普罗米修斯中显示指标的值

我在 prometheus alertmanager 中创建了一个规则,它以百分比表示挂载点上的最小空间 - 除此之外,我想以千兆字节显示最小空间,但我不想硬编码挂载点以显示千兆字节,我想使用 $ label.mountpoint 来自 "expr" ,而不是硬编码。

我在这个链接https://github.com/prometheus/alertmanager/issues/549上发现了一个类似的问题, 但在这种情况下使用硬编码的挂载点

这是我的规则

- alert: OutOfDiskSpace
    expr: node_filesystem_free_bytes / node_filesystem_size_bytes * 100 < 10
    for: 1m
    labels:
      severity: Critical
    annotations:
      description: "Disk is almost full (< 10% left)\n {{ $labels.instance_short }}\n {{ $labels.mountpoint }}\n VALUE = {{ printf `node_filesystem_avail_bytes / 1024 / 1024 / 1024` | query | first | value | humanize }}"

Run Code Online (Sandbox Code Playgroud)

当我node_filesystem_avail_bytes / 1024 / 1024 / 1024在 in 中使用时VALUE,我不从表达式中获取挂载点,但我知道实际值在哪里 …

prometheus prometheus-alertmanager

5
推荐指数
1
解决办法
2996
查看次数