麻烦输出一份prometheus的linux主机告警的rule规则配置文件呢
时间: 2024-03-27 09:40:32 浏览: 118
prometheus和loki的告警配置
当然可以,以下是一个简单的prometheus的Linux主机告警规则配置文件示例:
```
groups:
- name: host
rules:
- alert: HighCpuUsage
expr: (100 - (avg by(instance) (irate(node_cpu{mode="idle"}[5m])) * 100)) > 90
for: 5m
labels:
severity: warning
annotations:
summary: "High CPU usage on {{ $labels.instance }}"
description: "CPU usage on {{ $labels.instance }} has been above 90% for the last 5 minutes."
- alert: HighMemoryUsage
expr: (node_memory_MemAvailable / node_memory_MemTotal) * 100 < 10
for: 5m
labels:
severity: warning
annotations:
summary: "High memory usage on {{ $labels.instance }}"
description: "Memory usage on {{ $labels.instance }} has been above 90% for the last 5 minutes."
```
这个配置文件定义了两个警报规则。第一个规则检查 CPU 使用率是否超过了90%,第二个规则检查可用内存是否低于10%。如果这些条件满足,则会生成一个警报,并在Prometheus中显示警报消息。
阅读全文