main.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. ---
  2. prometheus_version: 2.37.0 # LTS
  3. prometheus_binary_local_dir: '' # default /usr/local/bin
  4. prometheus_skip_install: false
  5. prometheus_config_dir: /etc/prometheus
  6. prometheus_db_dir: /var/lib/prometheus
  7. prometheus_read_only_dirs: []
  8. prometheus_web_listen_address: "0.0.0.0:9090"
  9. prometheus_web_external_url: ''
  10. # See https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md
  11. prometheus_storage_retention: "30d"
  12. # Available since Prometheus 2.7.0
  13. # [EXPERIMENTAL] Maximum number of bytes that can be stored for blocks. Units
  14. # supported: KB, MB, GB, TB, PB.
  15. prometheus_storage_retention_size: "0"
  16. # Alternative config file name, searched in ansible templates path.
  17. prometheus_config_file: 'prometheus.yml.j2'
  18. prometheus_targets: "{{ all_targets }}"
  19. prometheus_alertmanager_config:
  20. - static_configs:
  21. - targets:
  22. - localhost:9093
  23. prometheus_scrape_configs:
  24. - job_name: "prometheus"
  25. metrics_path: "{{ prometheus_metrics_path }}"
  26. static_configs:
  27. - targets:
  28. - "{{ ansible_fqdn | default(ansible_host) | default('localhost') }}:9090"
  29. - job_name: "node"
  30. file_sd_configs:
  31. - files:
  32. - "{{ prometheus_config_dir }}/file_sd/node.yml"
  33. - job_name: 'blackbox-external-targets'
  34. metrics_path: /probe
  35. params:
  36. module: [http_2xx_head]
  37. static_configs:
  38. - targets:
  39. - https://www.google.com
  40. - https://www.ripe.net
  41. relabel_configs: "{{ blackbox_relabel_configs }}"
  42. - job_name: 'blackbox-server_head'
  43. metrics_path: /probe
  44. params:
  45. module: [http_2xx_head]
  46. static_configs:
  47. - targets:
  48. - https://ada
  49. relabel_configs: "{{ blackbox_relabel_configs }}"
  50. - job_name: 'blackbox-server_get'
  51. metrics_path: /probe
  52. params:
  53. module: [http_2xx_get]
  54. static_configs:
  55. - targets:
  56. - https://torrent.ada/
  57. relabel_configs: "{{ blackbox_relabel_configs }}"
  58. - job_name: 'blackbox-ping-external'
  59. metrics_path: /probe
  60. params:
  61. module: [icmp]
  62. static_configs:
  63. - targets:
  64. - 1.1.1.1
  65. - 8.8.8.8
  66. - 4.2.2.2
  67. relabel_configs: "{{ blackbox_relabel_configs }}"
  68. - job_name: 'blackbox-ping-internal'
  69. file_sd_configs:
  70. - files:
  71. - "{{ prometheus_config_dir }}/file_sd/blackbox_ping_internal.yml"
  72. metrics_path: /probe
  73. params:
  74. module: [icmp]
  75. relabel_configs: "{{ blackbox_relabel_configs }}"
  76. prometheus_alert_rules:
  77. - alert: Watchdog
  78. expr: vector(1)
  79. for: 10m
  80. labels:
  81. severity: warning
  82. annotations:
  83. description: "This is an alert meant to ensure that the entire alerting pipeline is functional.\nThis alert is always firing, therefore it should always be firing in Alertmanager\nand always fire against a receiver. There are integrations with various notification\nmechanisms that send a notification when this alert is not firing. For example the\n\"DeadMansSnitch\" integration in PagerDuty."
  84. summary: 'Ensure entire alerting pipeline is functional'
  85. - alert: NodeDown
  86. expr: "up{job=\"node\", alert=\"yes\"} == 0"
  87. for: 5m
  88. labels:
  89. severity: critical
  90. annotations:
  91. description: '{% raw %}{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes.{% endraw %}'
  92. summary: '{% raw %}Instance {{ $labels.instance }} down{% endraw %}'
  93. - alert: ToolDown
  94. expr: "probe_success{job=\"blackbox-ping-internal\"} == 0"
  95. for: 5m
  96. labels:
  97. severity: critical
  98. annotations:
  99. description: '{% raw %}{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes.{% endraw %}'
  100. summary: '{% raw %}Instance {{ $labels.instance }} down{% endraw %}'
  101. - alert: RebootRequired
  102. expr: 'node_reboot_required > 0'
  103. labels:
  104. severity: warning
  105. annotations:
  106. description: '{% raw %}{{ $labels.instance }} requires a reboot.{% endraw %}'
  107. summary: '{% raw %}Instance {{ $labels.instance }} - reboot required{% endraw %}'
  108. - alert: NodeFilesystemSpaceFillingUp
  109. annotations:
  110. description: '{% raw %}Filesystem on {{ $labels.device }} at {{ $labels.instance }} has only {{ printf "%.2f" $value }}% available space left and is filling up.{% endraw %}'
  111. summary: 'Filesystem is predicted to run out of space within the next 24 hours.'
  112. expr: "(\n node_filesystem_avail_bytes{job=\"node\",fstype!=\"\"} / node_filesystem_size_bytes{job=\"node\",fstype!=\"\"} * 100 < 40\nand\n predict_linear(node_filesystem_avail_bytes{job=\"node\",fstype!=\"\"}[6h], 24*60*60) < 0\nand\n node_filesystem_readonly{job=\"node\",fstype!=\"\"} == 0\n)\n"
  113. for: 1h
  114. labels:
  115. severity: warning
  116. - alert: NodeFilesystemSpaceFillingUp
  117. annotations:
  118. description: '{% raw %}Filesystem on {{ $labels.device }} at {{ $labels.instance }} has only {{ printf "%.2f" $value }}% available space left and is filling up fast.{% endraw %}'
  119. summary: 'Filesystem is predicted to run out of space within the next 4 hours.'
  120. expr: "(\n node_filesystem_avail_bytes{job=\"node\",fstype!=\"\"} / node_filesystem_size_bytes{job=\"node\",fstype!=\"\"} * 100 < 20\nand\n predict_linear(node_filesystem_avail_bytes{job=\"node\",fstype!=\"\"}[6h], 4*60*60) < 0\nand\n node_filesystem_readonly{job=\"node\",fstype!=\"\"} == 0\n)\n"
  121. for: 1h
  122. labels:
  123. severity: critical
  124. - alert: NodeFilesystemAlmostOutOfSpace
  125. annotations:
  126. description: '{% raw %}Filesystem on {{ $labels.device }} at {{ $labels.instance }} has only {{ printf "%.2f" $value }}% available space left.{% endraw %}'
  127. summary: 'Filesystem has less than 5% space left.'
  128. expr: "(\n node_filesystem_avail_bytes{job=\"node\",fstype!=\"\"} / node_filesystem_size_bytes{job=\"node\",fstype!=\"\"} * 100 < 5\nand\n node_filesystem_readonly{job=\"node\",fstype!=\"\"} == 0\n)\n"
  129. for: 1h
  130. labels:
  131. severity: warning
  132. - alert: NodeFilesystemAlmostOutOfSpace
  133. annotations:
  134. description: '{% raw %}Filesystem on {{ $labels.device }} at {{ $labels.instance }} has only {{ printf "%.2f" $value }}% available space left.{% endraw %}'
  135. summary: 'Filesystem has less than 3% space left.'
  136. expr: "(\n node_filesystem_avail_bytes{job=\"node\",fstype!=\"\"} / node_filesystem_size_bytes{job=\"node\",fstype!=\"\"} * 100 < 3\nand\n node_filesystem_readonly{job=\"node\",fstype!=\"\"} == 0\n)\n"
  137. for: 1h
  138. labels:
  139. severity: critical
  140. - alert: NodeFilesystemFilesFillingUp
  141. annotations:
  142. description: '{% raw %}Filesystem on {{ $labels.device }} at {{ $labels.instance }} has only {{ printf "%.2f" $value }}% available inodes left and is filling up.{% endraw %}'
  143. summary: 'Filesystem is predicted to run out of inodes within the next 24 hours.'
  144. expr: "(\n node_filesystem_files_free{job=\"node\",fstype!=\"\"} / node_filesystem_files{job=\"node\",fstype!=\"\"} * 100 < 40\nand\n predict_linear(node_filesystem_files_free{job=\"node\",fstype!=\"\"}[6h], 24*60*60) < 0\nand\n node_filesystem_readonly{job=\"node\",fstype!=\"\"} == 0\n)\n"
  145. for: 1h
  146. labels:
  147. severity: warning
  148. - alert: NodeFilesystemFilesFillingUp
  149. annotations:
  150. description: '{% raw %}Filesystem on {{ $labels.device }} at {{ $labels.instance }} has only {{ printf "%.2f" $value }}% available inodes left and is filling up fast.{% endraw %}'
  151. summary: 'Filesystem is predicted to run out of inodes within the next 4 hours.'
  152. expr: "(\n node_filesystem_files_free{job=\"node\",fstype!=\"\"} / node_filesystem_files{job=\"node\",fstype!=\"\"} * 100 < 20\nand\n predict_linear(node_filesystem_files_free{job=\"node\",fstype!=\"\"}[6h], 4*60*60) < 0\nand\n node_filesystem_readonly{job=\"node\",fstype!=\"\"} == 0\n)\n"
  153. for: 1h
  154. labels:
  155. severity: critical
  156. - alert: NodeFilesystemAlmostOutOfFiles
  157. annotations:
  158. description: '{% raw %}Filesystem on {{ $labels.device }} at {{ $labels.instance }} has only {{ printf "%.2f" $value }}% available inodes left.{% endraw %}'
  159. summary: 'Filesystem has less than 5% inodes left.'
  160. expr: "(\n node_filesystem_files_free{job=\"node\",fstype!=\"\"} / node_filesystem_files{job=\"node\",fstype!=\"\"} * 100 < 5\nand\n node_filesystem_readonly{job=\"node\",fstype!=\"\"} == 0\n)\n"
  161. for: 1h
  162. labels:
  163. severity: warning
  164. - alert: NodeFilesystemAlmostOutOfFiles
  165. annotations:
  166. description: '{% raw %}Filesystem on {{ $labels.device }} at {{ $labels.instance }} has only {{ printf "%.2f" $value }}% available inodes left.{% endraw %}'
  167. summary: 'Filesystem has less than 3% inodes left.'
  168. expr: "(\n node_filesystem_files_free{job=\"node\",fstype!=\"\"} / node_filesystem_files{job=\"node\",fstype!=\"\"} * 100 < 3\nand\n node_filesystem_readonly{job=\"node\",fstype!=\"\"} == 0\n)\n"
  169. for: 1h
  170. labels:
  171. severity: critical
  172. - alert: NodeNetworkReceiveErrs
  173. annotations:
  174. description: '{% raw %}{{ $labels.instance }} interface {{ $labels.device }} has encountered {{ printf "%.0f" $value }} receive errors in the last two minutes.{% endraw %}'
  175. summary: 'Network interface is reporting many receive errors.'
  176. expr: "increase(node_network_receive_errs_total[2m]) > 10\n"
  177. for: 1h
  178. labels:
  179. severity: warning
  180. - alert: NodeNetworkTransmitErrs
  181. annotations:
  182. description: '{% raw %}{{ $labels.instance }} interface {{ $labels.device }} has encountered {{ printf "%.0f" $value }} transmit errors in the last two minutes.{% endraw %}'
  183. summary: 'Network interface is reporting many transmit errors.'
  184. expr: "increase(node_network_transmit_errs_total[2m]) > 10\n"
  185. for: 1h
  186. labels:
  187. severity: warning
  188. - alert: NodeHighNumberConntrackEntriesUsed
  189. annotations:
  190. description: '{% raw %}{{ $value | humanizePercentage }} of conntrack entries are used{% endraw %}'
  191. summary: 'Number of conntrack are getting close to the limit'
  192. expr: "(node_nf_conntrack_entries / node_nf_conntrack_entries_limit) > 0.75\n"
  193. labels:
  194. severity: warning
  195. - alert: NodeClockSkewDetected
  196. annotations:
  197. message: '{% raw %}Clock on {{ $labels.instance }} is out of sync by more than 300s. Ensure NTP is configured correctly on this host.{% endraw %}'
  198. summary: 'Clock skew detected.'
  199. expr: "(\n node_timex_offset_seconds > 0.05\nand\n deriv(node_timex_offset_seconds[5m]) >= 0\n)\nor\n(\n node_timex_offset_seconds < -0.05\nand\n deriv(node_timex_offset_seconds[5m]) <= 0\n)\n"
  200. for: 10m
  201. labels:
  202. severity: warning
  203. - alert: NodeClockNotSynchronising
  204. annotations:
  205. message: '{% raw %}Clock on {{ $labels.instance }} is not synchronising. Ensure NTP is configured on this host.{% endraw %}'
  206. summary: 'Clock not synchronising.'
  207. expr: "min_over_time(node_timex_sync_status[5m]) == 0\n"
  208. for: 10m
  209. labels:
  210. severity: warning