你这个配置文件没有输出完整呀
时间: 2023-08-09 15:09:41 浏览: 50
非常抱歉,可能是我在回答过程中出现了一些问题,导致信息不完整。以下是一个更加丰富的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."
- alert: HighDiskUsage
expr: (node_filesystem_avail_bytes{mountpoint="/"}) / node_filesystem_size_bytes{mountpoint="/"} * 100 < 10
for: 5m
labels:
severity: warning
annotations:
summary: "High disk usage on {{ $labels.instance }}"
description: "Disk usage on {{ $labels.instance }} has been above 90% for the last 5 minutes."
- alert: NetworkTrafficDrop
expr: rate(node_network_receive_drop_total{device="eth0"}[5m]) > 0.5 or rate(node_network_transmit_drop_total{device="eth0"}[5m]) > 0.5
for: 5m
labels:
severity: critical
annotations:
summary: "Network traffic drop on {{ $labels.instance }}"
description: "Network traffic drop on {{ $labels.instance }} exceeds the threshold for the last 5 minutes."
- alert: HighDiskIOWait
expr: (avg by(instance) (irate(node_disk_io_time_seconds_total{device="sda", job="node"}[5m]))) > 0.5
for: 5m
labels:
severity: warning
annotations:
summary: "High disk I/O wait on {{ $labels.instance }}"
description: "Disk I/O wait time on {{ $labels.instance }} has been above 0.5 seconds for the last 5 minutes."
```
这个配置文件定义了五个警报规则。第一个规则检查 CPU 使用率是否超过了90%,第二个规则检查可用内存是否低于10%,第三个规则检查可用磁盘空间是否低于10%,第四个规则检查网络传输是否有丢包,第五个规则检查磁盘 I/O 等待时间是否超过了0.5秒。如果这些条件满足,则会生成一个警报,并在Prometheus中显示警报消息。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)