Linux系统监控

  1. groups:
  2. - name: node-alert
  3. rules:
  4. - alert: NodeDown
  5. expr: up{job="node"} == 0
  6. for: 5m
  7. labels:
  8. severity: critical
  9. instance: "{{ $labels.instance }}"
  10. annotations:
  11. summary: "instance: {{ $labels.instance }} down"
  12. description: "Instance: {{ $labels.instance }} 已经宕机 5分钟"
  13. value: "{{ $value }}"
  14. - alert: NodeCpuHigh
  15. expr: (1 - avg by (instance) (irate(node_cpu_seconds_total{job="node",mode="idle"}[5m]))) * 100 > 80
  16. for: 5m
  17. labels:
  18. severity: warning
  19. instance: "{{ $labels.instance }}"
  20. annotations:
  21. summary: "instance: {{ $labels.instance }} cpu使用率过高"
  22. description: "CPU 使用率超过 80%"
  23. value: "{{ $value }}"
  24. - alert: NodeCpuIowaitHigh
  25. expr: avg by (instance) (irate(node_cpu_seconds_total{job="node",mode="iowait"}[5m])) * 100 > 50
  26. for: 5m
  27. labels:
  28. severity: warning
  29. instance: "{{ $labels.instance }}"
  30. annotations:
  31. summary: "instance: {{ $labels.instance }} cpu iowait 使用率过高"
  32. description: "CPU iowait 使用率超过 50%"
  33. value: "{{ $value }}"
  34. - alert: NodeLoad5High
  35. expr: node_load5 > (count by (instance) (node_cpu_seconds_total{job="node",mode='system'})) * 1.2
  36. for: 5m
  37. labels:
  38. severity: warning
  39. instance: "{{ $labels.instance }}"
  40. annotations:
  41. summary: "instance: {{ $labels.instance }} load(5m) 过高"
  42. description: "Load(5m) 过高,超出cpu核数 1.2倍"
  43. value: "{{ $value }}"
  44. - alert: NodeMemoryHigh
  45. expr: (1 - node_memory_MemAvailable_bytes{job="node"} / node_memory_MemTotal_bytes{job="node"}) * 100 > 90
  46. for: 5m
  47. labels:
  48. severity: warning
  49. instance: "{{ $labels.instance }}"
  50. annotations:
  51. summary: "instance: {{ $labels.instance }} memory 使用率过高"
  52. description: "Memory 使用率超过 90%"
  53. value: "{{ $value }}"
  54. - alert: NodeDiskRootHigh
  55. expr: (1 - node_filesystem_avail_bytes{job="node",fstype=~"ext.*|xfs",mountpoint ="/"} / node_filesystem_size_bytes{job="node",fstype=~"ext.*|xfs",mountpoint ="/"}) * 100 > 90
  56. for: 10m
  57. labels:
  58. severity: warning
  59. instance: "{{ $labels.instance }}"
  60. annotations:
  61. summary: "instance: {{ $labels.instance }} disk(/ 分区) 使用率过高"
  62. description: "Disk(/ 分区) 使用率超过 90%"
  63. value: "{{ $value }}"
  64. - alert: NodeDiskBootHigh
  65. expr: (1 - node_filesystem_avail_bytes{job="node",fstype=~"ext.*|xfs",mountpoint ="/boot"} / node_filesystem_size_bytes{job="node",fstype=~"ext.*|xfs",mountpoint ="/boot"}) * 100 > 80
  66. for: 10m
  67. labels:
  68. severity: warning
  69. instance: "{{ $labels.instance }}"
  70. annotations:
  71. summary: "instance: {{ $labels.instance }} disk(/boot 分区) 使用率过高"
  72. description: "Disk(/boot 分区) 使用率超过 80%"
  73. value: "{{ $value }}"
  74. - alert: NodeDiskReadHigh
  75. expr: irate(node_disk_read_bytes_total{job="node"}[5m]) > 20 * (1024 ^ 2)
  76. for: 5m
  77. labels:
  78. severity: warning
  79. instance: "{{ $labels.instance }}"
  80. annotations:
  81. summary: "instance: {{ $labels.instance }} disk 读取字节数 速率过高"
  82. description: "Disk 读取字节数 速率超过 20 MB/s"
  83. value: "{{ $value }}"
  84. - alert: NodeDiskWriteHigh
  85. expr: irate(node_disk_written_bytes_total{job="node"}[5m]) > 20 * (1024 ^ 2)
  86. for: 5m
  87. labels:
  88. severity: warning
  89. instance: "{{ $labels.instance }}"
  90. annotations:
  91. summary: "instance: {{ $labels.instance }} disk 写入字节数 速率过高"
  92. description: "Disk 写入字节数 速率超过 20 MB/s"
  93. value: "{{ $value }}"
  94. - alert: NodeDiskReadRateCountHigh
  95. expr: irate(node_disk_reads_completed_total{job="node"}[5m]) > 3000
  96. for: 5m
  97. labels:
  98. severity: warning
  99. instance: "{{ $labels.instance }}"
  100. annotations:
  101. summary: "instance: {{ $labels.instance }} disk iops 每秒读取速率过高"
  102. description: "Disk iops 每秒读取速率超过 3000 iops"
  103. value: "{{ $value }}"
  104. - alert: NodeDiskWriteRateCountHigh
  105. expr: irate(node_disk_writes_completed_total{job="node"}[5m]) > 3000
  106. for: 5m
  107. labels:
  108. severity: warning
  109. instance: "{{ $labels.instance }}"
  110. annotations:
  111. summary: "instance: {{ $labels.instance }} disk iops 每秒写入速率过高"
  112. description: "Disk iops 每秒写入速率超过 3000 iops"
  113. value: "{{ $value }}"
  114. - alert: NodeInodeRootUsedPercentHigh
  115. expr: (1 - node_filesystem_files_free{job="node",fstype=~"ext4|xfs",mountpoint="/"} / node_filesystem_files{job="node",fstype=~"ext4|xfs",mountpoint="/"}) * 100 > 80
  116. for: 10m
  117. labels:
  118. severity: warning
  119. instance: "{{ $labels.instance }}"
  120. annotations:
  121. summary: "instance: {{ $labels.instance }} disk(/ 分区) inode 使用率过高"
  122. description: "Disk (/ 分区) inode 使用率超过 80%"
  123. value: "{{ $value }}"
  124. - alert: NodeInodeBootUsedPercentHigh
  125. expr: (1 - node_filesystem_files_free{job="node",fstype=~"ext4|xfs",mountpoint="/boot"} / node_filesystem_files{job="node",fstype=~"ext4|xfs",mountpoint="/boot"}) * 100 > 80
  126. for: 10m
  127. labels:
  128. severity: warning
  129. instance: "{{ $labels.instance }}"
  130. annotations:
  131. summary: "instance: {{ $labels.instance }} disk(/boot 分区) inode 使用率过高"
  132. description: "Disk (/boot 分区) inode 使用率超过 80%"
  133. value: "{{ $value }}"
  134. - alert: NodeFilefdAllocatedPercentHigh
  135. expr: node_filefd_allocated{job="node"} / node_filefd_maximum{job="node"} * 100 > 80
  136. for: 10m
  137. labels:
  138. severity: warning
  139. instance: "{{ $labels.instance }}"
  140. annotations:
  141. summary: "instance: {{ $labels.instance }} filefd 打开百分比过高"
  142. description: "Filefd 打开百分比 超过 80%"
  143. value: "{{ $value }}"
  144. - alert: NodeNetworkNetinBitRateHigh
  145. expr: avg by (instance) (irate(node_network_receive_bytes_total{device=~"eth0|eth1|ens33|ens37"}[1m]) * 8) > 20 * (1024 ^ 2) * 8
  146. for: 3m
  147. labels:
  148. severity: warning
  149. instance: "{{ $labels.instance }}"
  150. annotations:
  151. summary: "instance: {{ $labels.instance }} network 接收比特数 速率过高"
  152. description: "Network 接收比特数 速率超过 20MB/s"
  153. value: "{{ $value }}"
  154. - alert: NodeNetworkNetoutBitRateHigh
  155. expr: avg by (instance) (irate(node_network_transmit_bytes_total{device=~"eth0|eth1|ens33|ens37"}[1m]) * 8) > 20 * (1024 ^ 2) * 8
  156. for: 3m
  157. labels:
  158. severity: warning
  159. instance: "{{ $labels.instance }}"
  160. annotations:
  161. summary: "instance: {{ $labels.instance }} network 发送比特数 速率过高"
  162. description: "Network 发送比特数 速率超过 20MB/s"
  163. value: "{{ $value }}"
  164. - alert: NodeNetworkNetinPacketErrorRateHigh
  165. expr: avg by (instance) (irate(node_network_receive_errs_total{device=~"eth0|eth1|ens33|ens37"}[1m])) > 15
  166. for: 3m
  167. labels:
  168. severity: warning
  169. instance: "{{ $labels.instance }}"
  170. annotations:
  171. summary: "instance: {{ $labels.instance }} 接收错误包 速率过高"
  172. description: "Network 接收错误包 速率超过 15个/秒"
  173. value: "{{ $value }}"
  174. - alert: NodeNetworkNetoutPacketErrorRateHigh
  175. expr: avg by (instance) (irate(node_network_transmit_packets_total{device=~"eth0|eth1|ens33|ens37"}[1m])) > 15
  176. for: 3m
  177. labels:
  178. severity: warning
  179. instance: "{{ $labels.instance }}"
  180. annotations:
  181. summary: "instance: {{ $labels.instance }} 发送错误包 速率过高"
  182. description: "Network 发送错误包 速率超过 15个/秒"
  183. value: "{{ $value }}"
  184. - alert: NodeProcessBlockedHigh
  185. expr: node_procs_blocked{job="node"} > 10
  186. for: 10m
  187. labels:
  188. severity: warning
  189. instance: "{{ $labels.instance }}"
  190. annotations:
  191. summary: "instance: {{ $labels.instance }} 当前被阻塞的任务的数量过多"
  192. description: "Process 当前被阻塞的任务的数量超过 10个"
  193. value: "{{ $value }}"
  194. - alert: NodeTimeOffsetHigh
  195. expr: abs(node_timex_offset_seconds{job="node"}) > 3 * 60
  196. for: 2m
  197. labels:
  198. severity: info
  199. instance: "{{ $labels.instance }}"
  200. annotations:
  201. summary: "instance: {{ $labels.instance }} 时间偏差过大"
  202. description: "Time 节点的时间偏差超过 3m"
  203. value: "{{ $value }}"

windows系统监控

  1. groups:
  2. - name: windows-alert
  3. rules:
  4. - alert: 节点WODN状态
  5. expr: up{job="windows"} == 0
  6. for: 5m
  7. labels:
  8. severity: emergency
  9. instance: "{{ $labels.instance }}"
  10. annotations:
  11. summary: "instance: {{ $labels.instance }} down"
  12. description: "告警节点: {{ $labels.instance }} 告警内容:已经宕机5分钟"
  13. value: "{{ $value }}"
  14. - alert: CPU使用率高
  15. expr: 100 - (avg by (instance) (irate(windows_cpu_time_total{job="windows",mode="idle"}[2m])) * 100) > 80
  16. for: 5m
  17. labels:
  18. severity: warning
  19. instance: "{{ $labels.instance }}"
  20. annotations:
  21. summary: "instance: {{ $labels.instance }} CPU使用率高"
  22. description: "告警节点: {{ $labels.instance }} 告警内容: CUP使用率超过80%(当前值:{{ $value}})"
  23. value: "{{ $value }}"
  24. - alert: 内存使用率高
  25. expr: 100.0 - 100 * windows_os_physical_memory_free_bytes{job="windows"} / windows_cs_physical_memory_bytes{job="windows"} > 40
  26. for: 5m
  27. labels:
  28. severity: warning
  29. instance: "{{ $labels.instance }}"
  30. annotations:
  31. summary: "instance: {{ $labels.instance }} 内存使用率高"
  32. description: "告警节点: {{ $labels.instance }} 告警内容:内存使用率超过70%(当前值:{{ $value}})"
  33. value: "{{ $value }}"
  34. - alert: C盘使用率高
  35. expr: (1 - (windows_logical_disk_free_bytes{job="windows",volume=~"C:"}/windows_logical_disk_size_bytes{job="windows",volume=~"C:"}))*100 > 85
  36. for: 5m
  37. labels:
  38. severity: critical
  39. instance: "{{ $labels.instance }}"
  40. annotations:
  41. summary: "instance: {{ $labels.instance }} C盘使用率高"
  42. description: "告警节点: {{ $labels.instance }} 告警内容:C盘使用率超过85%(当前值:{{ $value}})"
  43. value: "{{ $value }}"
  44. - alert: 磁盘使用率高
  45. expr: (max by (instance) (1-windows_logical_disk_free_bytes{job="windows"}/windows_logical_disk_size_bytes{job="windows"}))*100 > 85
  46. for: 5m
  47. labels:
  48. severity: critical
  49. instance: "{{ $labels.instance }}"
  50. annotations:
  51. summary: "instance: {{ $labels.instance }} 磁盘使用率高"
  52. description: "告警节点: {{ $labels.instance }} 告警内容:磁盘使用率超过85%(当前值:{{ $value}})"
  53. value: "{{ $value }}"
  54. - alert: 网络使用率高
  55. expr: (irate(windows_net_bytes_total{job="windows",nic!~'isatap.*|VPN.*'}[5m]) * 8 / windows_net_current_bandwidth{job="windows",nic!~'isatap.*|VPN.*'}) * 100 > 0.5
  56. for: 5m
  57. labels:
  58. severity: warning
  59. instance: "{{ $labels.instance }}"
  60. annotations:
  61. summary: "instance: {{ $labels.instance }} 网络使用率高"
  62. description: "告警节点: {{ $labels.instance }} 告警内容:网络使用率超过50%(当前值:{{ $value}})"
  63. value: "{{ $value }}"