fix: deduplicate filesystem mounts in monitoring

This commit is contained in:
hectorzhao
2026-08-31 23:39:24 +08:00
parent 12668cee87
commit 1f2dfb5caf
14 changed files with 246 additions and 51 deletions
+8 -8
View File
@@ -108,50 +108,50 @@ groups:
threshold: "95%"
- alert: HostRootDiskUsageWarning
expr: ((1 - node_filesystem_avail_bytes{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"} / node_filesystem_size_bytes{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"}) * 100 > 80) and ((1 - node_filesystem_avail_bytes{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"} / node_filesystem_size_bytes{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"}) * 100 <= 90)
expr: (max by (instance, device, fstype) ((1 - node_filesystem_avail_bytes{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"} / node_filesystem_size_bytes{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"}) * 100) > 80) and (max by (instance, device, fstype) ((1 - node_filesystem_avail_bytes{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"} / node_filesystem_size_bytes{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"}) * 100) <= 90)
for: 15m
labels:
severity: warning
service: host
annotations:
summary: 磁盘文件系统空间不足
description: "磁盘文件系统使用率连续15分钟高于80%。 挂载点{{ $labels.mountpoint }};设备:{{ $labels.device }}。"
description: "磁盘文件系统使用率连续15分钟高于80%。 设备{{ $labels.device }};文件系统:{{ $labels.fstype }}(绑定挂载已合并)。"
currentValue: "{{ printf \"%.1f\" $value }}%"
threshold: "80%"
- alert: HostRootDiskUsageCritical
expr: (1 - node_filesystem_avail_bytes{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"} / node_filesystem_size_bytes{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"}) * 100 > 90
expr: max by (instance, device, fstype) ((1 - node_filesystem_avail_bytes{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"} / node_filesystem_size_bytes{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"}) * 100) > 90
for: 5m
labels:
severity: critical
service: host
annotations:
summary: 磁盘文件系统空间严重不足
description: "磁盘文件系统使用率连续5分钟高于90%。 挂载点{{ $labels.mountpoint }};设备:{{ $labels.device }}。"
description: "磁盘文件系统使用率连续5分钟高于90%。 设备{{ $labels.device }};文件系统:{{ $labels.fstype }}(绑定挂载已合并)。"
currentValue: "{{ printf \"%.1f\" $value }}%"
threshold: "90%"
- alert: HostRootInodeUsageWarning
expr: ((1 - node_filesystem_files_free{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"} / node_filesystem_files{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"}) * 100 > 80) and ((1 - node_filesystem_files_free{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"} / node_filesystem_files{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"}) * 100 <= 90)
expr: (max by (instance, device, fstype) ((1 - node_filesystem_files_free{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"} / node_filesystem_files{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"}) * 100) > 80) and (max by (instance, device, fstype) ((1 - node_filesystem_files_free{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"} / node_filesystem_files{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"}) * 100) <= 90)
for: 15m
labels:
severity: warning
service: host
annotations:
summary: 磁盘文件系统inode余量偏低
description: "磁盘文件系统inode使用率连续15分钟高于80%。 挂载点{{ $labels.mountpoint }};设备:{{ $labels.device }}。"
description: "磁盘文件系统inode使用率连续15分钟高于80%。 设备{{ $labels.device }};文件系统:{{ $labels.fstype }}(绑定挂载已合并)。"
currentValue: "{{ printf \"%.1f\" $value }}%"
threshold: "80%"
- alert: HostRootInodeUsageCritical
expr: (1 - node_filesystem_files_free{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"} / node_filesystem_files{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"}) * 100 > 90
expr: max by (instance, device, fstype) ((1 - node_filesystem_files_free{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"} / node_filesystem_files{device=~"/dev/.+",fstype!~"tmpfs|devtmpfs|overlay|squashfs|ramfs"}) * 100) > 90
for: 5m
labels:
severity: critical
service: host
annotations:
summary: 磁盘文件系统inode严重不足
description: "磁盘文件系统inode使用率连续5分钟高于90%。 挂载点{{ $labels.mountpoint }};设备:{{ $labels.device }}。"
description: "磁盘文件系统inode使用率连续5分钟高于90%。 设备{{ $labels.device }};文件系统:{{ $labels.fstype }}(绑定挂载已合并)。"
currentValue: "{{ printf \"%.1f\" $value }}%"
threshold: "90%"