checks.tf 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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. "dnstest.msoc.defpoint.local": "10.10.10.10",
  16. "dnstest.mdr-test.defpoint.com": "10.10.10.10",
  17. } : {
  18. "dnstest.pvt.xdr.accenturefederalcyber.com": "10.10.10.10",
  19. "10.10.10.10": "dnstest.pvt.xdr.accenturefederalcyber.com.",
  20. "dnstest.msoc.defpoint.local": "10.10.10.10",
  21. "dnstest.mdr.defpoint.com": "10.10.10.10",
  22. }
  23. }
  24. resource "sensu_check" "check_dns_all" {
  25. for_each = local.dns_checks_all
  26. name = "check_dns_${ each.key }"
  27. command = "check_dns --hostname=${ each.key } --expected-address=${ each.value } --warning=${ var.sensu_checks["dns"]["warning"] } --critical=${ var.sensu_checks["dns"]["critical"] }"
  28. namespace = "default"
  29. subscriptions = [ "linux", ]
  30. handlers = [ "victorops", "logfile", ]
  31. cron = "* * * * *"
  32. publish = "true"
  33. runtime_assets = [ "sensu-plugins-monitoring", ]
  34. }
  35. resource "sensu_check" "check_dns_private" {
  36. for_each = local.dns_checks_private
  37. name = "check_dns_${ each.key }"
  38. command = "check_dns --hostname=${ each.key } --expected-address=${ each.value } --warning=${ var.sensu_checks["dns"]["warning"] } --critical=${ var.sensu_checks["dns"]["critical"] }"
  39. namespace = "default"
  40. subscriptions = [ "private_dns_client", ]
  41. handlers = [ "victorops", "logfile", ]
  42. cron = "* * * * *"
  43. publish = "true"
  44. runtime_assets = [ "sensu-plugins-monitoring", ]
  45. }
  46. resource "sensu_check" "check_disk_base" {
  47. name = "check_disk_base"
  48. command = "check_disk -c 250 -p /var -C -c 500 -p /var/log -C -c 1000 -p /var/log/audit -C -c 2000 -p /opt -C -c 500 -p /boot -C -c 1000 -p /"
  49. namespace = "default"
  50. subscriptions = [ "linux", ]
  51. handlers = [ "victorops", "logfile", ]
  52. cron = "* * * * *"
  53. publish = "true"
  54. runtime_assets = [ "sensu-plugins-monitoring", ]
  55. }
  56. resource "sensu_check" "check_disk_indexer" {
  57. name = "check_disk_indexer"
  58. command = "check_disk -c ${local.splunk_hot} -p /opt/splunkdata/hot -C -c 5000 -p /opt/splunk"
  59. namespace = "default"
  60. subscriptions = [ "check_disk_indexer", ]
  61. handlers = [ "victorops", "logfile", ]
  62. cron = "* * * * *"
  63. publish = "true"
  64. runtime_assets = [ "sensu-plugins-monitoring", ]
  65. }
  66. resource "sensu_check" "check_disk_syslog" {
  67. name = "check_disk_syslog"
  68. command = "check_disk -c 7000 -p /opt/syslog-ng"
  69. namespace = "default"
  70. subscriptions = [ "check_disk_syslog", ]
  71. handlers = [ "victorops", "logfile", ]
  72. cron = "* * * * *"
  73. publish = "true"
  74. runtime_assets = [ "sensu-plugins-monitoring", ]
  75. }
  76. resource "sensu_check" "check_ping_interconnect-0" {
  77. for_each = toset(local.interconnect-0)
  78. name = "ping_interconnect-0-${index(local.interconnect-0, each.value) +1}"
  79. command = "check_ping -H ${each.value} -w 500,80% -c 500,80% -4"
  80. namespace = "default"
  81. subscriptions = [ "interconnect-0", ]
  82. handlers = [ "victorops", "logfile", ]
  83. cron = "* * * * *"
  84. publish = "true"
  85. runtime_assets = [ "sensu-plugins-monitoring", ]
  86. }
  87. resource "sensu_check" "check_ping_interconnect-1" {
  88. for_each = toset(local.interconnect-1)
  89. name = "ping_interconnect-1-${index(local.interconnect-1, each.value) +1}"
  90. command = "check_ping -H ${each.value} -w 500,80% -c 500,80% -4"
  91. namespace = "default"
  92. subscriptions = [ "interconnect-1", ]
  93. handlers = [ "victorops", "logfile", ]
  94. cron = "* * * * *"
  95. publish = "true"
  96. runtime_assets = [ "sensu-plugins-monitoring", ]
  97. }
  98. resource "sensu_check" "check_phantom_ports" {
  99. name = "phantom_ports"
  100. command = "check-ports.rb -h 0.0.0.0 -p 443"
  101. namespace = "default"
  102. subscriptions = [ "phantom_ports", ]
  103. handlers = [ "victorops", "logfile", ]
  104. cron = "* * * * *"
  105. publish = "true"
  106. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  107. }
  108. resource "sensu_check" "check_portal_http" {
  109. name = "portal_http"
  110. command = "check-http.rb -u https://portal.${var.dns_info["public"]["zone"]}/api/health/ --response-code 200"
  111. namespace = "default"
  112. subscriptions = [ "portal", ]
  113. handlers = [ "victorops", "logfile", ]
  114. cron = "* * * * *"
  115. publish = "true"
  116. runtime_assets = [ "sensu-plugins-http", "sensu-ruby-runtime", ]
  117. }
  118. resource "sensu_check" "check_salt_master_ports" {
  119. name = "salt_master_ports"
  120. command = "check-ports.rb -h 0.0.0.0 -p 4505,4506"
  121. namespace = "default"
  122. subscriptions = [ "salt_master_ports", ]
  123. handlers = [ "victorops", "logfile", ]
  124. cron = "* * * * *"
  125. publish = "true"
  126. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  127. }
  128. resource "sensu_check" "check_splunk_cm_ports" {
  129. name = "splunk_cm_ports"
  130. command = "check-ports.rb -h 0.0.0.0 -p 8089"
  131. namespace = "default"
  132. subscriptions = [ "splunk_cm_ports", ]
  133. handlers = [ "victorops", "logfile", ]
  134. cron = "* * * * *"
  135. publish = "true"
  136. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  137. }
  138. resource "sensu_check" "check_splunk_ds_ports" {
  139. name = "splunk_ds_ports"
  140. command = "check-ports.rb -h 0.0.0.0 -p 8089"
  141. namespace = "default"
  142. subscriptions = [ "splunk_ds_ports", ]
  143. handlers = [ "victorops", "logfile", ]
  144. cron = "* * * * *"
  145. publish = "true"
  146. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  147. }
  148. resource "sensu_check" "check_splunk_hf_ports" {
  149. name = "splunk_hf_ports"
  150. command = "check-ports.rb -h 0.0.0.0 -p 8089,8000"
  151. namespace = "default"
  152. subscriptions = [ "splunk_hf_ports", ]
  153. handlers = [ "victorops", "logfile", ]
  154. cron = "* * * * *"
  155. publish = "true"
  156. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  157. }
  158. resource "sensu_check" "check_splunk_indexer_ports_moose" {
  159. name = "splunk_indexer_ports_moose"
  160. command = "check-ports.rb -h 0.0.0.0 -p 8089,9998,9887,8088"
  161. namespace = "default"
  162. subscriptions = [ "splunk_indexer_ports_moose", ]
  163. handlers = [ "victorops", "logfile", ]
  164. cron = "* * * * *"
  165. publish = "true"
  166. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  167. }
  168. resource "sensu_check" "check_splunk_indexer_ports" {
  169. name = "splunk_indexer_ports"
  170. command = "check-ports.rb -h 0.0.0.0 -p 8089,9998,9887"
  171. namespace = "default"
  172. subscriptions = [ "splunk_indexer_ports", ]
  173. handlers = [ "victorops", "logfile", ]
  174. cron = "* * * * *"
  175. publish = "true"
  176. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  177. }
  178. resource "sensu_check" "check_splunk_sh_ports" {
  179. name = "splunk_sh_ports"
  180. command = "check-ports.rb -h 0.0.0.0 -p 8089,8000"
  181. namespace = "default"
  182. subscriptions = [ "splunk_sh_ports", ]
  183. handlers = [ "victorops", "logfile", ]
  184. cron = "* * * * *"
  185. publish = "true"
  186. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  187. }
  188. resource "sensu_check" "check_splunk_uf_ports" {
  189. name = "splunk_uf_ports"
  190. command = "check-ports.rb -h 0.0.0.0 -p 8089"
  191. namespace = "default"
  192. subscriptions = [ "splunk", ]
  193. handlers = [ "victorops", "logfile", ]
  194. cron = "* * * * *"
  195. publish = "true"
  196. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  197. }
  198. resource "sensu_check" "check_syslog-ng_service" {
  199. name = "syslog-ng_service"
  200. command = "check-process.rb -p syslog-ng"
  201. namespace = "default"
  202. subscriptions = [ "syslog-ng_service", ]
  203. handlers = [ "victorops", "logfile", ]
  204. cron = "* * * * *"
  205. publish = "true"
  206. runtime_assets = [ "sensu-plugins-process-checks", "sensu-ruby-runtime", ]
  207. }