针对于VMware_Vcenter的prometheus的告警规则:
groups:
- name: VMware_Monitoring
rules:
# 主机CPU使用率告警
- alert: 主机CPU使用率过高
expr: 100 - (avg by (instance) (irate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) > 80
for: 10m
labels:
severity: warning
annotations:
summary: "High CPU usage on host {{ $labels.instance }}"
description: "主机 {{ $labels.instance }} CPU使用率已超过 80%."
# 主机内存使用率告警
- alert: 主机内存使用率过高
expr: (node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes) / node_memory_MemTotal_bytes > 0.8
for: 10m
labels:
severity: warning
annotations:
summary: "High memory usage on host {{ $labels.instance }}"
description: "主机 {{ $labels.instance }} 内存使用率已超过 80%."
# 主机磁盘使用率告警
- alert: 主机磁盘使用率过高
expr: (node_filesystem_size_bytes{fstype=~"ext4|xfs"} - node_filesystem_free_bytes{fstype=~"ext4|xfs"}) / node_filesystem_size_bytes{fstype=~"ext4|xfs"} > 0.8
for: 10m
labels:
severity: warning
annotations:
summary: "High disk usage on host {{ $labels.instance }}"
description: "主机 {{ $labels.instance }} 内存使用率已超过 80%."
# 虚拟机CPU使用率告警
- alert: 虚拟机CPU使用率过高
expr: rate(vmware_vm_cpu_usage_average[5m]) > 80
for: 10m
labels:
severity: warning
annotations:
summary: "High CPU usage on VM {{ $labels.instance }}"
description: "VM {{ $labels.instance }} CPU使用率已超过 80%."
# 虚拟机内存使用率告警
- alert: 虚拟机内存使用率过高
expr: rate(vmware_vm_mem_usage_average[5m]) > 80
for: 10m
labels:
severity: warning
annotations:
summary: "High memory usage on VM {{ $labels.instance }}"
description: "VM {{ $labels.instance }} 内存使用率已超过 80%."
# 虚拟机磁盘使用率告警
- alert: 虚拟机磁盘使用率过高
expr: rate(vmware_vm_disk_usage_average[5m]) > 80
for: 10m
labels:
severity: warning
annotations:
summary: "High disk usage on VM {{ $labels.instance }}"
description: "VM {{ $labels.instance }} 磁盘使用率已超过 80%."