MON-96 - Update ALB monitors with inputs best practice

This commit is contained in:
Alexandre Gaillet 2018-03-20 14:52:59 +01:00
parent 98d6194f0c
commit ad6ad29d9e
3 changed files with 105 additions and 9 deletions

View File

@ -30,21 +30,33 @@ Inputs
| Name | Description | Type | Default | Required | | Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:| |------|-------------|:----:|:-----:|:-----:|
| alb_no_healthy_instances_message | Custom message for ALB no healthy instances monitor | string | `` | no |
| alb_no_healthy_instances_silenced | Groups to mute for ALB no healthy instances monitor | map | `<map>` | no |
| delay | Delay in seconds for the metric evaluation | string | `900` | no | | delay | Delay in seconds for the metric evaluation | string | `900` | no |
| environment | Architecture environment | string | - | yes | | environment | Architecture environment | string | - | yes |
| filter_tags_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `*` | no | | filter_tags_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `*` | no |
| filter_tags_use_defaults | Use default filter tags convention | string | `*` | no | | filter_tags_use_defaults | Use default filter tags convention | string | `true` | no |
| httpcode_elb_4xx_message | Custom message for ALB httpcode 4xx monitor | string | `` | no |
| httpcode_elb_4xx_silenced | Groups to mute for ALB httpcode 4xx monitor | map | `<map>` | no |
| httpcode_elb_4xx_threshold_critical | loadbalancer 4xx critical threshold in percentage | string | `80` | no | | httpcode_elb_4xx_threshold_critical | loadbalancer 4xx critical threshold in percentage | string | `80` | no |
| httpcode_elb_4xx_threshold_warning | loadbalancer 4xx warning threshold in percentage | string | `60` | no | | httpcode_elb_4xx_threshold_warning | loadbalancer 4xx warning threshold in percentage | string | `60` | no |
| httpcode_elb_5xx_threshold_critical | loadbalancer 5xx critical threshold in percentage | string | `80` | no | | httpcode_elb_5xx_message | Custom message for ALB httpcode 5xx monitor | string | `` | no |
| httpcode_elb_5xx_silenced | Groups to mute for ALB httpcode 5xx monitor | map | `<map>` | no |
| httpcode_elb_5xx_threshold_critical | loadbalancer 5xxcritical threshold in percentage | string | `80` | no |
| httpcode_elb_5xx_threshold_warning | loadbalancer 5xx warning threshold in percentage | string | `60` | no | | httpcode_elb_5xx_threshold_warning | loadbalancer 5xx warning threshold in percentage | string | `60` | no |
| httpcode_target_4xx_message | Custom message for ALB target httpcode 4xx monitor | string | `` | no |
| httpcode_target_4xx_silenced | Groups to mute for ALB target httpcode 4xx monitor | map | `<map>` | no |
| httpcode_target_4xx_threshold_critical | target 4xx critical threshold in percentage | string | `80` | no | | httpcode_target_4xx_threshold_critical | target 4xx critical threshold in percentage | string | `80` | no |
| httpcode_target_4xx_threshold_warning | target 4xx warning threshold in percentage | string | `60` | no | | httpcode_target_4xx_threshold_warning | target 4xx warning threshold in percentage | string | `60` | no |
| httpcode_target_5xx_message | Custom message for ALB target httpcode 5xx monitor | string | `` | no |
| httpcode_target_5xx_silenced | Groups to mute for ALB target httpcode 5xx monitor | map | `<map>` | no |
| httpcode_target_5xx_threshold_critical | target 5xx critical threshold in percentage | string | `80` | no | | httpcode_target_5xx_threshold_critical | target 5xx critical threshold in percentage | string | `80` | no |
| httpcode_target_5xx_threshold_warning | target 5xx warning threshold in percentage | string | `60` | no | | httpcode_target_5xx_threshold_warning | target 5xx warning threshold in percentage | string | `60` | no |
| message | Message sent when a monitor is triggered | string | - | yes | | latency_message | Custom message for ALB latency monitor | string | `` | no |
| latency_silenced | Groups to mute for ALB latency monitor | map | `<map>` | no |
| latency_threshold_critical | latency critical threshold in milliseconds | string | `1000` | no | | latency_threshold_critical | latency critical threshold in milliseconds | string | `1000` | no |
| latency_threshold_warning | latency warning threshold in milliseconds | string | `500` | no | | latency_threshold_warning | latency warning threshold in milliseconds | string | `500` | no |
| message | Message sent when a monitor is triggered | string | - | yes |
Related documentation Related documentation
--------------------- ---------------------

View File

@ -26,6 +26,30 @@ variable "delay" {
# Datadog monitors variables # Datadog monitors variables
variable "alb_no_healthy_instances_silenced" {
description = "Groups to mute for ALB no healthy instances monitor"
type = "map"
default = {}
}
variable "alb_no_healthy_instances_message" {
description = "Custom message for ALB no healthy instances monitor"
type = "string"
default = ""
}
variable "latency_silenced" {
description = "Groups to mute for ALB latency monitor"
type = "map"
default = {}
}
variable "latency_message" {
description = "Custom message for ALB latency monitor"
type = "string"
default = ""
}
variable "latency_threshold_critical" { variable "latency_threshold_critical" {
default = 1000 default = 1000
description = "latency critical threshold in milliseconds" description = "latency critical threshold in milliseconds"
@ -36,6 +60,18 @@ variable "latency_threshold_warning" {
description = "latency warning threshold in milliseconds" description = "latency warning threshold in milliseconds"
} }
variable "httpcode_elb_4xx_silenced" {
description = "Groups to mute for ALB httpcode 4xx monitor"
type = "map"
default = {}
}
variable "httpcode_elb_4xx_message" {
description = "Custom message for ALB httpcode 4xx monitor"
type = "string"
default = ""
}
variable "httpcode_elb_4xx_threshold_critical" { variable "httpcode_elb_4xx_threshold_critical" {
default = 80 default = 80
description = "loadbalancer 4xx critical threshold in percentage" description = "loadbalancer 4xx critical threshold in percentage"
@ -46,6 +82,18 @@ variable "httpcode_elb_4xx_threshold_warning" {
description = "loadbalancer 4xx warning threshold in percentage" description = "loadbalancer 4xx warning threshold in percentage"
} }
variable "httpcode_target_4xx_silenced" {
description = "Groups to mute for ALB target httpcode 4xx monitor"
type = "map"
default = {}
}
variable "httpcode_target_4xx_message" {
description = "Custom message for ALB target httpcode 4xx monitor"
type = "string"
default = ""
}
variable "httpcode_target_4xx_threshold_critical" { variable "httpcode_target_4xx_threshold_critical" {
default = 80 default = 80
description = "target 4xx critical threshold in percentage" description = "target 4xx critical threshold in percentage"
@ -56,6 +104,18 @@ variable "httpcode_target_4xx_threshold_warning" {
description = "target 4xx warning threshold in percentage" description = "target 4xx warning threshold in percentage"
} }
variable "httpcode_elb_5xx_silenced" {
description = "Groups to mute for ALB httpcode 5xx monitor"
type = "map"
default = {}
}
variable "httpcode_elb_5xx_message" {
description = "Custom message for ALB httpcode 5xx monitor"
type = "string"
default = ""
}
variable "httpcode_elb_5xx_threshold_critical" { variable "httpcode_elb_5xx_threshold_critical" {
default = 80 default = 80
description = "loadbalancer 5xxcritical threshold in percentage" description = "loadbalancer 5xxcritical threshold in percentage"
@ -66,6 +126,18 @@ variable "httpcode_elb_5xx_threshold_warning" {
description = "loadbalancer 5xx warning threshold in percentage" description = "loadbalancer 5xx warning threshold in percentage"
} }
variable "httpcode_target_5xx_silenced" {
description = "Groups to mute for ALB target httpcode 5xx monitor"
type = "map"
default = {}
}
variable "httpcode_target_5xx_message" {
description = "Custom message for ALB target httpcode 5xx monitor"
type = "string"
default = ""
}
variable "httpcode_target_5xx_threshold_critical" { variable "httpcode_target_5xx_threshold_critical" {
default = 80 default = 80
description = "target 5xx critical threshold in percentage" description = "target 5xx critical threshold in percentage"

View File

@ -11,7 +11,7 @@ data "template_file" "filter" {
resource "datadog_monitor" "ALB_no_healthy_instances" { resource "datadog_monitor" "ALB_no_healthy_instances" {
name = "[${var.environment}] ALB no healthy instances" name = "[${var.environment}] ALB no healthy instances"
type = "metric alert" type = "metric alert"
message = "${var.message}" message = "${coalesce(var.alb_no_healthy_instances_message, var.message)}"
query = <<EOF query = <<EOF
min(last_1m): ( min(last_1m): (
@ -32,13 +32,15 @@ resource "datadog_monitor" "ALB_no_healthy_instances" {
timeout_h = 0 timeout_h = 0
include_tags = true include_tags = true
silenced = "${var.alb_no_healthy_instances_silenced}"
tags = ["env:${var.environment}", "resource:alb", "team:aws", "provider:aws"] tags = ["env:${var.environment}", "resource:alb", "team:aws", "provider:aws"]
} }
resource "datadog_monitor" "ALB_latency" { resource "datadog_monitor" "ALB_latency" {
name = "[${var.environment}] ALB latency {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)" name = "[${var.environment}] ALB latency {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
type = "metric alert" type = "metric alert"
message = "${var.message}" message = "${coalesce(var.latency_message, var.message)}"
query = <<EOF query = <<EOF
min(last_5m): ( min(last_5m): (
@ -60,13 +62,15 @@ resource "datadog_monitor" "ALB_latency" {
timeout_h = 0 timeout_h = 0
include_tags = true include_tags = true
silenced = "${var.latency_silenced}"
tags = ["env:${var.environment}", "resource:alb", "team:aws", "provider:aws"] tags = ["env:${var.environment}", "resource:alb", "team:aws", "provider:aws"]
} }
resource "datadog_monitor" "ALB_httpcode_elb_5xx" { resource "datadog_monitor" "ALB_httpcode_elb_5xx" {
name = "[${var.environment}] ALB HTTP code 5xx {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)" name = "[${var.environment}] ALB HTTP code 5xx {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
type = "metric alert" type = "metric alert"
message = "${var.message}" message = "${coalesce(var.httpcode_elb_5xx_message, var.message)}"
query = <<EOF query = <<EOF
sum(last_5m): ( sum(last_5m): (
@ -89,13 +93,15 @@ resource "datadog_monitor" "ALB_httpcode_elb_5xx" {
timeout_h = 1 timeout_h = 1
include_tags = true include_tags = true
silenced = "${var.httpcode_elb_5xx_silenced}"
tags = ["env:${var.environment}", "resource:alb", "team:aws", "provider:aws"] tags = ["env:${var.environment}", "resource:alb", "team:aws", "provider:aws"]
} }
resource "datadog_monitor" "ALB_httpcode_elb_4xx" { resource "datadog_monitor" "ALB_httpcode_elb_4xx" {
name = "[${var.environment}] ALB HTTP code 4xx {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)" name = "[${var.environment}] ALB HTTP code 4xx {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
type = "metric alert" type = "metric alert"
message = "${var.message}" message = "${coalesce(var.httpcode_elb_4xx_message, var.message)}"
query = <<EOF query = <<EOF
sum(last_5m): ( sum(last_5m): (
@ -118,13 +124,15 @@ resource "datadog_monitor" "ALB_httpcode_elb_4xx" {
timeout_h = 1 timeout_h = 1
include_tags = true include_tags = true
silenced = "${var.httpcode_elb_4xx_silenced}"
tags = ["env:${var.environment}", "resource:alb", "team:aws", "provider:aws"] tags = ["env:${var.environment}", "resource:alb", "team:aws", "provider:aws"]
} }
resource "datadog_monitor" "ALB_httpcode_target_5xx" { resource "datadog_monitor" "ALB_httpcode_target_5xx" {
name = "[${var.environment}] ALB target HTTP code 5xx {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)" name = "[${var.environment}] ALB target HTTP code 5xx {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
type = "metric alert" type = "metric alert"
message = "${var.message}" message = "${coalesce(var.httpcode_target_5xx_message, var.message)}"
query = <<EOF query = <<EOF
sum(last_5m): ( sum(last_5m): (
@ -147,13 +155,15 @@ resource "datadog_monitor" "ALB_httpcode_target_5xx" {
timeout_h = 1 timeout_h = 1
include_tags = true include_tags = true
silenced = "${var.httpcode_target_5xx_silenced}"
tags = ["env:${var.environment}", "resource:alb", "team:aws", "provider:aws"] tags = ["env:${var.environment}", "resource:alb", "team:aws", "provider:aws"]
} }
resource "datadog_monitor" "ALB_httpcode_target_4xx" { resource "datadog_monitor" "ALB_httpcode_target_4xx" {
name = "[${var.environment}] ALB target HTTP code 4xx {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)" name = "[${var.environment}] ALB target HTTP code 4xx {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
type = "metric alert" type = "metric alert"
message = "${var.message}" message = "${coalesce(var.httpcode_target_4xx_message, var.message)}"
query = <<EOF query = <<EOF
sum(last_5m): ( sum(last_5m): (
@ -176,5 +186,7 @@ resource "datadog_monitor" "ALB_httpcode_target_4xx" {
timeout_h = 1 timeout_h = 1
include_tags = true include_tags = true
silenced = "${var.httpcode_target_4xx_silenced}"
tags = ["env:${var.environment}", "resource:alb", "team:aws", "provider:aws"] tags = ["env:${var.environment}", "resource:alb", "team:aws", "provider:aws"]
} }