checks.tf 9.1 KB

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