promtheus告警规则
node_filesystem_readonly == 1
过滤指定文件格式
报警规则:
node_filesystem_files_free{fstype=~"(ext.|xfs)"} / node_filesystem_files{fstype=~"(ext.|xfs)"} * 100 < 20
查看系统文件格式:
df -hT
过滤规则修改为:
node_filesystem_readonly{fstype=~"(ext.|xfs|tmpfs|overlay)"} == 1
rules.yaml 修改
- alert: comm-filesystem_readonly expr: node_filesystem_readonly{fstype=~"(ext.|xfs|tmpfs|overlay)"} == 1 for: 1m labels: severity: critical annotations: description: "平台{{ $labels.instance }}节点文件系统{{ $labels.mountpoint}}状态为只读" summary: "Filesystem has been ReadOnly status."二:检查规则有效性
#yaml 格式检查
https://www.yamllint.com/
promtool check config prometheus.yml
promtool check rules conf/rules/redis-exporter.yml
#./promtool check rules conf/rules/node-exporter_record_rules.yaml
需要使用单引号
否则报错,key不对之类