checks.tf 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. locals {
  2. splunk_hot = var.environment == "test" ? "10000" : "50000"
  3. #interconnect-0 = var.environment == "test" ? ["169.254.230.197", "169.254.142.233", "169.254.221.229", "169.254.145.141"] : ["169.254.152.217", "169.254.88.105", "169.254.253.45", "169.254.91.129"]
  4. #interconnect-1 = var.environment == "test" ? ["169.254.186.189", "169.254.119.73", "169.254.20.161", "169.254.128.189"] : ["169.254.247.157", "169.254.246.157", "169.254.22.21", "169.254.38.13"]
  5. dns_checks_all = var.environment == "test" ? {
  6. "dnstest.accenturefederalcyber.com": "203.0.113.1",
  7. "dnstest.xdrtest.accenturefederalcyber.com": "203.0.113.1",
  8. } : {
  9. "dnstest.accenturefederalcyber.com": "203.0.113.1",
  10. "dnstest.xdr.accenturefederalcyber.com": "203.0.113.1",
  11. }
  12. dns_checks_private = var.environment == "test" ? {
  13. "dnstest.pvt.xdrtest.accenturefederalcyber.com": "10.10.10.10",
  14. "10.10.10.10": "dnstest.pvt.xdrtest.accenturefederalcyber.com.",
  15. } : {
  16. "dnstest.pvt.xdr.accenturefederalcyber.com": "10.10.10.10",
  17. "10.10.10.10": "dnstest.pvt.xdr.accenturefederalcyber.com.",
  18. }
  19. standard_paths = {
  20. "root": "20%",
  21. "/tmp": "20%",
  22. "/home": "20%",
  23. "/var": "20%",
  24. "/var/tmp": "20%",
  25. "/var/log": "20%"
  26. "/var/log/audit": "20%",
  27. "/opt": "20%",
  28. "/boot": "20%",
  29. }
  30. indexer_paths = {
  31. "/opt/splunk": 5000,
  32. "/opt/splunkdata/hot": local.splunk_hot,
  33. }
  34. syslog_paths = {
  35. "/opt/syslog-ng": 7000
  36. }
  37. }
  38. resource "sensu_check" "check_dns_all" {
  39. for_each = local.dns_checks_all
  40. name = "check_dns_${ each.key }"
  41. command = "check_dns --hostname=${ each.key } --expected-address=${ each.value } --warning=${ var.sensu_checks["dns"]["warning"] } --critical=${ var.sensu_checks["dns"]["critical"] }"
  42. namespace = "default"
  43. subscriptions = [ "linux", ]
  44. handlers = [ "victorops", "logfile", ]
  45. cron = "* * * * *"
  46. publish = "true"
  47. runtime_assets = [ "sensu-plugins-monitoring", ]
  48. }
  49. resource "sensu_check" "check_dns_private" {
  50. for_each = local.dns_checks_private
  51. name = "check_dns_${ each.key }"
  52. command = "check_dns --hostname=${ each.key } --expected-address=${ each.value } --warning=${ var.sensu_checks["dns"]["warning"] } --critical=${ var.sensu_checks["dns"]["critical"] }"
  53. namespace = "default"
  54. subscriptions = [ "private_dns_client", ]
  55. handlers = [ "victorops", "logfile", ]
  56. cron = "* * * * *"
  57. publish = "true"
  58. runtime_assets = [ "sensu-plugins-monitoring", ]
  59. }
  60. resource "sensu_check" "check_disk_standard_paths" {
  61. for_each = local.standard_paths
  62. name = "check_disk_base_${ replace(each.key, "/", "_") }"
  63. command = "check_disk -c ${ each.value } -p ${ replace(each.key, "root", "/") }"
  64. namespace = "default"
  65. subscriptions = [ "linux", ]
  66. handlers = [ "victorops", "logfile", ]
  67. cron = "* * * * *"
  68. publish = "true"
  69. runtime_assets = [ "sensu-plugins-monitoring", ]
  70. }
  71. resource "sensu_check" "check_disk_indexer_paths" {
  72. for_each = local.indexer_paths
  73. name = "check_disk_indexer_${ replace(each.key, "/", "_") }"
  74. command = "check_disk -c ${ each.value } -p ${ replace(each.key, "root", "/") }"
  75. namespace = "default"
  76. subscriptions = [ "check_disk_indexer", ]
  77. handlers = [ "victorops", "logfile", ]
  78. cron = "* * * * *"
  79. publish = "true"
  80. runtime_assets = [ "sensu-plugins-monitoring", ]
  81. }
  82. resource "sensu_check" "check_disk_syslog_paths" {
  83. for_each = local.syslog_paths
  84. name = "check_disk_syslog_${ replace(each.key, "/", "_") }"
  85. command = "check_disk -c ${ each.value } -p ${ replace(each.key, "root", "/") }"
  86. namespace = "default"
  87. subscriptions = [ "check_disk_syslog", ]
  88. handlers = [ "victorops", "logfile", ]
  89. cron = "* * * * *"
  90. publish = "true"
  91. runtime_assets = [ "sensu-plugins-monitoring", ]
  92. }
  93. #resource "sensu_check" "check_ping_interconnect-0" {
  94. # for_each = toset(local.interconnect-0)
  95. # name = "ping_interconnect-0-${index(local.interconnect-0, each.value) +1}"
  96. # command = "check_ping -H ${each.value} -w 500,80% -c 500,80% -4"
  97. # namespace = "default"
  98. # subscriptions = [ "interconnect-0", ]
  99. # handlers = [ "victorops", "logfile", ]
  100. # cron = "* * * * *"
  101. # publish = "true"
  102. # runtime_assets = [ "sensu-plugins-monitoring", ]
  103. #}
  104. #
  105. #resource "sensu_check" "check_ping_interconnect-1" {
  106. # for_each = toset(local.interconnect-1)
  107. # name = "ping_interconnect-1-${index(local.interconnect-1, each.value) +1}"
  108. # command = "check_ping -H ${each.value} -w 500,80% -c 500,80% -4"
  109. # namespace = "default"
  110. # subscriptions = [ "interconnect-1", ]
  111. # handlers = [ "victorops", "logfile", ]
  112. # cron = "* * * * *"
  113. # publish = "true"
  114. # runtime_assets = [ "sensu-plugins-monitoring", ]
  115. #}
  116. resource "sensu_check" "check_phantom_ports" {
  117. name = "phantom_ports"
  118. command = "check-ports.rb -h 0.0.0.0 -p 443"
  119. namespace = "default"
  120. subscriptions = [ "phantom_ports", ]
  121. handlers = [ "victorops", "logfile", ]
  122. cron = "* * * * *"
  123. publish = "true"
  124. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  125. }
  126. resource "sensu_check" "check_portal_http" {
  127. name = "portal_http"
  128. command = "check-http.rb -u https://portal.${var.dns_info["public"]["zone"]}/api/health/ --response-code 200"
  129. namespace = "default"
  130. subscriptions = [ "portal", ]
  131. handlers = [ "victorops", "logfile", ]
  132. cron = "* * * * *"
  133. publish = "true"
  134. runtime_assets = [ "sensu-plugins-http", "sensu-ruby-runtime", ]
  135. }
  136. resource "sensu_check" "check_salt_master_ports" {
  137. name = "salt_master_ports"
  138. command = "check-ports.rb -h 0.0.0.0 -p 4505,4506"
  139. namespace = "default"
  140. subscriptions = [ "salt_master_ports", ]
  141. handlers = [ "victorops", "logfile", ]
  142. cron = "* * * * *"
  143. publish = "true"
  144. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  145. }
  146. resource "sensu_check" "check_splunk_cm_ports" {
  147. name = "splunk_cm_ports"
  148. command = "check-ports.rb -h 0.0.0.0 -p 8089"
  149. namespace = "default"
  150. subscriptions = [ "splunk_cm_ports", ]
  151. handlers = [ "victorops", "logfile", ]
  152. cron = "* * * * *"
  153. publish = "true"
  154. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  155. }
  156. resource "sensu_check" "check_splunk_ds_ports" {
  157. name = "splunk_ds_ports"
  158. command = "check-ports.rb -h 0.0.0.0 -p 8089"
  159. namespace = "default"
  160. subscriptions = [ "splunk_ds_ports", ]
  161. handlers = [ "victorops", "logfile", ]
  162. cron = "* * * * *"
  163. publish = "true"
  164. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  165. }
  166. resource "sensu_check" "check_splunk_hf_ports" {
  167. name = "splunk_hf_ports"
  168. command = "check-ports.rb -h 0.0.0.0 -p 8089,8000"
  169. namespace = "default"
  170. subscriptions = [ "splunk_hf_ports", ]
  171. handlers = [ "victorops", "logfile", ]
  172. cron = "* * * * *"
  173. publish = "true"
  174. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  175. }
  176. resource "sensu_check" "check_splunk_indexer_ports_moose" {
  177. name = "splunk_indexer_ports_moose"
  178. command = "check-ports.rb -h 0.0.0.0 -p 8089,9998,9887,8088"
  179. namespace = "default"
  180. subscriptions = [ "splunk_indexer_ports_moose", ]
  181. handlers = [ "victorops", "logfile", ]
  182. cron = "* * * * *"
  183. publish = "true"
  184. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  185. }
  186. resource "sensu_check" "check_splunk_indexer_ports" {
  187. name = "splunk_indexer_ports"
  188. command = "check-ports.rb -h 0.0.0.0 -p 8089,9998,9887"
  189. namespace = "default"
  190. subscriptions = [ "splunk_indexer_ports", ]
  191. handlers = [ "victorops", "logfile", ]
  192. cron = "* * * * *"
  193. publish = "true"
  194. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  195. }
  196. resource "sensu_check" "check_splunk_sh_ports" {
  197. name = "splunk_sh_ports"
  198. command = "check-ports.rb -h 0.0.0.0 -p 8089,8000"
  199. namespace = "default"
  200. subscriptions = [ "splunk_sh_ports", ]
  201. handlers = [ "victorops", "logfile", ]
  202. cron = "* * * * *"
  203. publish = "true"
  204. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  205. }
  206. resource "sensu_check" "check_splunk_uf_ports" {
  207. name = "splunk_uf_ports"
  208. command = "check-ports.rb -h 0.0.0.0 -p 8089"
  209. namespace = "default"
  210. subscriptions = [ "splunk", ]
  211. handlers = [ "victorops", "logfile", ]
  212. cron = "* * * * *"
  213. publish = "true"
  214. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  215. }
  216. resource "sensu_check" "check_syslog-ng_service" {
  217. name = "syslog-ng_service"
  218. command = "check-process.rb -p syslog-ng"
  219. namespace = "default"
  220. subscriptions = [ "syslog-ng_service", ]
  221. handlers = [ "victorops", "logfile", ]
  222. cron = "* * * * *"
  223. publish = "true"
  224. runtime_assets = [ "sensu-plugins-process-checks", "sensu-ruby-runtime", ]
  225. }
  226. resource "sensu_check" "check_salt-minion_service" {
  227. name = "salt-minion_service"
  228. command = "check-process.rb -p salt-minion --critical-under 1 --critical-over 5"
  229. namespace = "default"
  230. subscriptions = [ "salt-minion_service", ]
  231. handlers = [ "victorops", "logfile", ]
  232. cron = "* * * * *"
  233. publish = "true"
  234. runtime_assets = [ "sensu-plugins-process-checks", "sensu-ruby-runtime", ]
  235. }