Browse Source

Adds Sensu Checks for DNS

Fred Damstra 4 years ago
parent
commit
c52c742b02
1 changed files with 43 additions and 1 deletions
  1. 43 1
      base/sensu-configuration/checks.tf

+ 43 - 1
base/sensu-configuration/checks.tf

@@ -2,6 +2,48 @@ locals {
   splunk_hot = var.environment == "test" ? "10000" : "50000"
   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"]
   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"]
+  dns_checks_all = var.environment == "test" ? {
+    "dnstest.accenturefederalcyber.com": "203.0.113.1",
+    "dnstest.xdrtest.accenturefederalcyber.com": "203.0.113.1",
+  } : { 
+    "dnstest.accenturefederalcyber.com": "203.0.113.1",
+    "dnstest.xdr.accenturefederalcyber.com": "203.0.113.1",
+  }
+  dns_checks_private = var.environment == "test" ? {
+    "dnstest.pvt.xdrtest.accenturefederalcyber.com": "10.10.10.10",
+    "10.10.10.10": "dnstest.pvt.xdrtest.accenturefederalcyber.com.",
+    "dnstest.msoc.defpoint.local": "10.10.10.10",
+    "dnstest.mdr-test.defpoint.com": "10.10.10.10",
+  } : {
+    "dnstest.pvt.xdr.accenturefederalcyber.com": "10.10.10.10",
+    "10.10.10.10": "dnstest.pvt.xdr.accenturefederalcyber.com.",
+    "dnstest.msoc.defpoint.local": "10.10.10.10",
+    "dnstest.mdr.defpoint.com": "10.10.10.10",
+  }
+}
+
+resource "sensu_check" "check_dns_all" {
+  for_each       = local.dns_checks_all
+  name           = "check_dns_${ each.key }"
+  command        = "check_dns --hostname=${ each.key } --expected-address=${ each.value } --warning=0.5  --critical=5"
+  namespace      = "default"
+  subscriptions  = [ "linux", ]
+  handlers       = [ "victorops", ]
+  cron           = "* * * * *"
+  publish        = "true"
+  runtime_assets = [ "sensu-plugins-monitoring", ]
+}
+
+resource "sensu_check" "check_dns_private" {
+  for_each       = local.dns_checks_private
+  name           = "check_dns_${ each.key }"
+  command        = "check_dns --hostname=${ each.key } --expected-address=${ each.value } --warning=0.5  --critical=5"
+  namespace      = "default"
+  subscriptions  = [ "private_dns_client", ]
+  handlers       = [ "victorops", ]
+  cron           = "* * * * *"
+  publish        = "true"
+  runtime_assets = [ "sensu-plugins-monitoring", ]
 }
 
 resource "sensu_check" "check_disk_base" {
@@ -182,4 +224,4 @@ resource "sensu_check" "check_syslog-ng_service" {
   cron           = "* * * * *"
   publish        = "true"
   runtime_assets = [ "sensu-plugins-process-checks", "sensu-ruby-runtime", ]
-}
+}