From e6530c5943d2075196d3fc80b36cf1bbc2b3b137 Mon Sep 17 00:00:00 2001 From: vincent EL KHATIB Date: Tue, 12 Sep 2017 14:55:42 +0200 Subject: [PATCH] MON-43 add monitor eld --- inputs.tf | 12 ++++++++++++ monitors_elb.tf | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 monitors_elb.tf diff --git a/inputs.tf b/inputs.tf index 980a3a1..1939e5e 100644 --- a/inputs.tf +++ b/inputs.tf @@ -49,6 +49,18 @@ variable "rds_mem_threshold" { } } +## ELB +variable "dd_aws_elb" { + default = "disable" +} +variable "elb_config" { + type = "map" + default = { + notify_no_data = false + delay = 900 + } +} + diff --git a/monitors_elb.tf b/monitors_elb.tf new file mode 100644 index 0000000..f6a8433 --- /dev/null +++ b/monitors_elb.tf @@ -0,0 +1,41 @@ +resource "datadog_monitor" "ELB_no_healthy_instances" { + name = "[${var.env}] ELB no healthy instances on {{host.identifier}}" + message = "{{#is_alert}}\n${var.hno_escalation_group} \n{{/is_alert}} \n{{#is_recovery}}\n${var.hno_escalation_group}\n{{/is_recovery}}" + + count = "${var.dd_aws_elb == "enabled" ? 1 : 0 }" + query = "avg(last_5m):avg:aws.elb.healthy_host_count{dd_monitoring:enabled,dd_aws_elb:enabled,env:${var.env}} by {identifier,region} == 0" + type = "query alert" + + notify_no_data = "${var.elb_config["notify_no_data"]}" + evaluation_delay = "${var.elb_config["delay"]}" + renotify_interval = 60 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true + new_host_delay = "${var.elb_config["delay"]}" + no_data_timeframe = 20 +} + +resource "datadog_monitor" "ELB_unhealthy_instances" { + name = "[${var.env}] ELB some unhealthy instances on {{host.identifier}}" + message = "{{#is_alert}}\n${var.ho_escalation_group} \n{{/is_alert}} \n{{#is_recovery}}\n${var.ho_escalation_group}\n{{/is_recovery}}" + + count = "${var.dd_aws_elb == "enabled" ? 1 : 0 }" + query = "avg(last_5m):avg:aws.elb.healthy_host_count{dd_monitoring:enabled,dd_aws_elb:enabled,env:${var.env}} by {identifier,region} == 0" + type = "query alert" + + notify_no_data = "${var.elb_config["notify_no_data"]}" + evaluation_delay = "${var.elb_config["delay"]}" + renotify_interval = 60 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true + new_host_delay = "${var.elb_config["delay"]}" + no_data_timeframe = 20 +} + +