checks.tf 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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=0.5 --critical=5"
  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=0.5 --critical=5"
  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. #only needed in PROD
  109. resource "sensu_check" "check_portal_http" {
  110. count = var.environment == "test" ? 0 : 1
  111. name = "portal_http"
  112. command = "metrics-curl.rb -u https://portal.xdr.accenturefederalcyber.com"
  113. namespace = "default"
  114. subscriptions = [ "portal", ]
  115. handlers = [ "victorops", "logfile", ]
  116. cron = "* * * * *"
  117. publish = "true"
  118. runtime_assets = [ "sensu-plugins-http", "sensu-ruby-runtime", ]
  119. }
  120. resource "sensu_check" "check_salt_master_ports" {
  121. name = "salt_master_ports"
  122. command = "check-ports.rb -h 0.0.0.0 -p 4505,4506"
  123. namespace = "default"
  124. subscriptions = [ "salt_master_ports", ]
  125. handlers = [ "victorops", "logfile", ]
  126. cron = "* * * * *"
  127. publish = "true"
  128. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  129. }
  130. resource "sensu_check" "check_splunk_cm_ports" {
  131. name = "splunk_cm_ports"
  132. command = "check-ports.rb -h 0.0.0.0 -p 8089"
  133. namespace = "default"
  134. subscriptions = [ "splunk_cm_ports", ]
  135. handlers = [ "victorops", "logfile", ]
  136. cron = "* * * * *"
  137. publish = "true"
  138. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  139. }
  140. resource "sensu_check" "check_splunk_ds_ports" {
  141. name = "splunk_ds_ports"
  142. command = "check-ports.rb -h 0.0.0.0 -p 8089"
  143. namespace = "default"
  144. subscriptions = [ "splunk_ds_ports", ]
  145. handlers = [ "victorops", "logfile", ]
  146. cron = "* * * * *"
  147. publish = "true"
  148. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  149. }
  150. resource "sensu_check" "check_splunk_hf_ports" {
  151. name = "splunk_hf_ports"
  152. command = "check-ports.rb -h 0.0.0.0 -p 8089,8000"
  153. namespace = "default"
  154. subscriptions = [ "splunk_hf_ports", ]
  155. handlers = [ "victorops", "logfile", ]
  156. cron = "* * * * *"
  157. publish = "true"
  158. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  159. }
  160. resource "sensu_check" "check_splunk_indexer_ports_moose" {
  161. name = "splunk_indexer_ports_moose"
  162. command = "check-ports.rb -h 0.0.0.0 -p 8089,9998,9887,8088"
  163. namespace = "default"
  164. subscriptions = [ "splunk_indexer_ports_moose", ]
  165. handlers = [ "victorops", "logfile", ]
  166. cron = "* * * * *"
  167. publish = "true"
  168. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  169. }
  170. resource "sensu_check" "check_splunk_indexer_ports" {
  171. name = "splunk_indexer_ports"
  172. command = "check-ports.rb -h 0.0.0.0 -p 8089,9998,9887"
  173. namespace = "default"
  174. subscriptions = [ "splunk_indexer_ports", ]
  175. handlers = [ "victorops", "logfile", ]
  176. cron = "* * * * *"
  177. publish = "true"
  178. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  179. }
  180. resource "sensu_check" "check_splunk_sh_ports" {
  181. name = "splunk_sh_ports"
  182. command = "check-ports.rb -h 0.0.0.0 -p 8089,8000"
  183. namespace = "default"
  184. subscriptions = [ "splunk_sh_ports", ]
  185. handlers = [ "victorops", "logfile", ]
  186. cron = "* * * * *"
  187. publish = "true"
  188. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  189. }
  190. resource "sensu_check" "check_splunk_uf_ports" {
  191. name = "splunk_uf_ports"
  192. command = "check-ports.rb -h 0.0.0.0 -p 8089"
  193. namespace = "default"
  194. subscriptions = [ "splunk", ]
  195. handlers = [ "victorops", "logfile", ]
  196. cron = "* * * * *"
  197. publish = "true"
  198. runtime_assets = [ "sensu-plugins-network-checks", "sensu-ruby-runtime", ]
  199. }
  200. resource "sensu_check" "check_syslog-ng_service" {
  201. name = "syslog-ng_service"
  202. command = "check-process.rb -p syslog-ng"
  203. namespace = "default"
  204. subscriptions = [ "syslog-ng_service", ]
  205. handlers = [ "victorops", "logfile", ]
  206. cron = "* * * * *"
  207. publish = "true"
  208. runtime_assets = [ "sensu-plugins-process-checks", "sensu-ruby-runtime", ]
  209. }