MON-499 Service checks modified to use the standard structure and values.

This commit is contained in:
Rafael Romero Carmona 2019-08-30 12:26:20 +01:00
parent ac5b9e3262
commit 70894689a2
12 changed files with 18 additions and 118 deletions

View File

@ -24,10 +24,8 @@ Creates DataDog monitors with the following checks:
|------|-------------|:----:|:-----:|:-----:| |------|-------------|:----:|:-----:|:-----:|
| cannot\_resolve\_enabled | Flag to enable DNS cannot resolve monitor | string | `"true"` | no | | cannot\_resolve\_enabled | Flag to enable DNS cannot resolve monitor | string | `"true"` | no |
| cannot\_resolve\_extra\_tags | Extra tags for DNS cannot resolve monitor | list(string) | `[]` | no | | cannot\_resolve\_extra\_tags | Extra tags for DNS cannot resolve monitor | list(string) | `[]` | no |
| cannot\_resolve\_last | Parameter 'last' for the service check | string | `"6"` | no |
| cannot\_resolve\_message | Custom message for DNS cannot resolve monitor | string | `""` | no | | cannot\_resolve\_message | Custom message for DNS cannot resolve monitor | string | `""` | no |
| cannot\_resolve\_no\_data\_timeframe | DNS cannot resolve monitor no data timeframe | string | `"10"` | no | | cannot\_resolve\_no\_data\_timeframe | DNS cannot resolve monitor no data timeframe | string | `"10"` | no |
| cannot\_resolve\_threshold\_critical | DNS cannot resolve monitor (warning threshold) | string | `"5"` | no |
| cannot\_resolve\_threshold\_warning | DNS cannot resolve monitor (warning threshold) | string | `"3"` | no | | cannot\_resolve\_threshold\_warning | DNS cannot resolve monitor (warning threshold) | string | `"3"` | no |
| environment | Architecture Environment | string | n/a | yes | | environment | Architecture Environment | string | n/a | yes |
| evaluation\_delay | Delay in seconds for the metric evaluation | string | `"15"` | no | | evaluation\_delay | Delay in seconds for the metric evaluation | string | `"15"` | no |

View File

@ -54,24 +54,12 @@ variable "cannot_resolve_message" {
default = "" default = ""
} }
variable "cannot_resolve_last" {
description = "Parameter 'last' for the service check"
type = string
default = 6
}
variable "cannot_resolve_threshold_warning" { variable "cannot_resolve_threshold_warning" {
description = "DNS cannot resolve monitor (warning threshold)" description = "DNS cannot resolve monitor (warning threshold)"
type = string type = string
default = 3 default = 3
} }
variable "cannot_resolve_threshold_critical" {
description = "DNS cannot resolve monitor (warning threshold)"
type = string
default = 5
}
variable "cannot_resolve_no_data_timeframe" { variable "cannot_resolve_no_data_timeframe" {
description = "DNS cannot resolve monitor no data timeframe" description = "DNS cannot resolve monitor no data timeframe"
type = string type = string

View File

@ -8,12 +8,12 @@ resource "datadog_monitor" "cannot_resolve" {
type = "service check" type = "service check"
query = <<EOQ query = <<EOQ
"dns.can_resolve"${module.filter-tags.service_check}.by("nameserver","resolved_hostname").last(${var.cannot_resolve_last}).count_by_status() "dns.can_resolve"${module.filter-tags.service_check}.by("nameserver","resolved_hostname").last(6).count_by_status()
EOQ EOQ
thresholds = { thresholds = {
warning = var.cannot_resolve_threshold_warning warning = var.cannot_resolve_threshold_warning
critical = var.cannot_resolve_threshold_critical critical = 5
} }
new_host_delay = var.new_host_delay new_host_delay = var.new_host_delay

View File

@ -37,11 +37,9 @@ Creates DataDog monitors with the following checks:
| filter\_tags\_use\_defaults | Use default filter tags convention | string | `"true"` | no | | filter\_tags\_use\_defaults | Use default filter tags convention | string | `"true"` | no |
| invalid\_ssl\_certificate\_enabled | Flag to enable SSL invalid certificate monitor | string | `"true"` | no | | invalid\_ssl\_certificate\_enabled | Flag to enable SSL invalid certificate monitor | string | `"true"` | no |
| invalid\_ssl\_certificate\_extra\_tags | Extra tags for SSL invalid certificate monitor | list(string) | `[]` | no | | invalid\_ssl\_certificate\_extra\_tags | Extra tags for SSL invalid certificate monitor | list(string) | `[]` | no |
| invalid\_ssl\_certificate\_last | Parameter 'last' for the service check | string | `"6"` | no |
| invalid\_ssl\_certificate\_message | Custom message for SSL invalid certificate monitor | string | `""` | no | | invalid\_ssl\_certificate\_message | Custom message for SSL invalid certificate monitor | string | `""` | no |
| invalid\_ssl\_certificate\_no\_data\_timeframe | SSL invalid certificate monitor no data timeframe | string | `"10"` | no | | invalid\_ssl\_certificate\_no\_data\_timeframe | SSL invalid certificate monitor no data timeframe | string | `"10"` | no |
| invalid\_ssl\_certificate\_threshold\_critical | SSL invalid certificate monitor (warning threshold) | string | `"5"` | no | | invalid\_ssl\_certificate\_threshold\_warning | SSL invalid certificate monitor (warning threshold) | string | `"3"` | no |
| invalid\_ssl\_certificate\_threshold\_warning | SSL invalid certificate monitor (warning threshold) | string | `"5"` | no |
| message | Message sent when an alert is triggered | string | n/a | yes | | message | Message sent when an alert is triggered | string | n/a | yes |
| new\_host\_delay | Delay in seconds before monitor new resource | string | `"300"` | no | | new\_host\_delay | Delay in seconds before monitor new resource | string | `"300"` | no |
| prefix\_slug | Prefix string to prepend between brackets on every monitors names | string | `""` | no | | prefix\_slug | Prefix string to prepend between brackets on every monitors names | string | `""` | no |

View File

@ -54,22 +54,10 @@ variable "invalid_ssl_certificate_message" {
default = "" default = ""
} }
variable "invalid_ssl_certificate_last" {
description = "Parameter 'last' for the service check"
type = string
default = 6
}
variable "invalid_ssl_certificate_threshold_warning" { variable "invalid_ssl_certificate_threshold_warning" {
description = "SSL invalid certificate monitor (warning threshold)" description = "SSL invalid certificate monitor (warning threshold)"
type = string type = string
default = 5 default = 3
}
variable "invalid_ssl_certificate_threshold_critical" {
description = "SSL invalid certificate monitor (warning threshold)"
type = string
default = 5
} }
variable "invalid_ssl_certificate_no_data_timeframe" { variable "invalid_ssl_certificate_no_data_timeframe" {

View File

@ -8,12 +8,12 @@ resource "datadog_monitor" "invalid_ssl_certificate" {
type = "service check" type = "service check"
query = <<EOQ query = <<EOQ
"http.ssl_cert"${module.filter-tags.service_check}.by("instance","url").last(${var.invalid_ssl_certificate_last}).count_by_status() "http.ssl_cert"${module.filter-tags.service_check}.by("instance","url").last(6).count_by_status()
EOQ EOQ
thresholds = { thresholds = {
warning = var.invalid_ssl_certificate_threshold_warning warning = var.invalid_ssl_certificate_threshold_warning
critical = var.invalid_ssl_certificate_threshold_critical critical = 5
} }
new_host_delay = var.new_host_delay new_host_delay = var.new_host_delay

View File

@ -24,12 +24,9 @@ Creates DataDog monitors with the following checks:
|------|-------------|:----:|:-----:|:-----:| |------|-------------|:----:|:-----:|:-----:|
| cannot\_connect\_enabled | Flag to enable HTTP cannot connect monitor | string | `"true"` | no | | cannot\_connect\_enabled | Flag to enable HTTP cannot connect monitor | string | `"true"` | no |
| cannot\_connect\_extra\_tags | Extra tags for HTTP cannot connect monitor | list(string) | `[]` | no | | cannot\_connect\_extra\_tags | Extra tags for HTTP cannot connect monitor | list(string) | `[]` | no |
| cannot\_connect\_last | Parameter 'last' for the service check | string | `"6"` | no |
| cannot\_connect\_message | Custom message for HTTP cannot connect monitor | string | `""` | no | | cannot\_connect\_message | Custom message for HTTP cannot connect monitor | string | `""` | no |
| cannot\_connect\_no\_data\_timeframe | HTTP cannot connect monitor no data timeframe | string | `"10"` | no | | cannot\_connect\_no\_data\_timeframe | HTTP cannot connect monitor no data timeframe | string | `"10"` | no |
| cannot\_connect\_threshold\_critical | HTTP cannot connect monitor (warning threshold) | string | `"3"` | no | | cannot\_connect\_threshold\_warning | HTTP cannot connect monitor (warning threshold) | string | `"3"` | no |
| cannot\_connect\_threshold\_ok | HTTP cannot connect monitor (ok threshold) | string | `"3"` | no |
| cannot\_connect\_threshold\_warning | HTTP cannot connect monitor (warning threshold) | string | `"2"` | no |
| environment | Architecture Environment | string | n/a | yes | | environment | Architecture Environment | string | n/a | yes |
| evaluation\_delay | Delay in seconds for the metric evaluation | string | `"15"` | no | | evaluation\_delay | Delay in seconds for the metric evaluation | string | `"15"` | no |
| 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 |

View File

@ -54,27 +54,9 @@ variable "cannot_connect_message" {
default = "" default = ""
} }
variable "cannot_connect_last" {
description = "Parameter 'last' for the service check"
type = string
default = 6
}
variable "cannot_connect_threshold_warning" { variable "cannot_connect_threshold_warning" {
description = "HTTP cannot connect monitor (warning threshold)" description = "HTTP cannot connect monitor (warning threshold)"
type = string type = string
default = 2
}
variable "cannot_connect_threshold_critical" {
description = "HTTP cannot connect monitor (warning threshold)"
type = string
default = 3
}
variable "cannot_connect_threshold_ok" {
description = "HTTP cannot connect monitor (ok threshold)"
type = string
default = 3 default = 3
} }

View File

@ -8,13 +8,12 @@ resource "datadog_monitor" "cannot_connect" {
type = "service check" type = "service check"
query = <<EOQ query = <<EOQ
"http.can_connect"${module.filter-tags.service_check}.by("instance","url").last(${var.cannot_connect_last}).count_by_status() "http.can_connect"${module.filter-tags.service_check}.by("instance","url").last(6).count_by_status()
EOQ EOQ
thresholds = { thresholds = {
warning = var.cannot_connect_threshold_warning warning = var.cannot_connect_threshold_warning
critical = var.cannot_connect_threshold_critical critical = 5
ok = var.cannot_connect_threshold_ok
} }
new_host_delay = var.new_host_delay new_host_delay = var.new_host_delay

View File

@ -27,12 +27,9 @@ Creates DataDog monitors with the following checks:
|------|-------------|:----:|:-----:|:-----:| |------|-------------|:----:|:-----:|:-----:|
| cannot\_connect\_enabled | Flag to enable TLS cannot connect monitor | string | `"true"` | no | | cannot\_connect\_enabled | Flag to enable TLS cannot connect monitor | string | `"true"` | no |
| cannot\_connect\_extra\_tags | Extra tags for TLS cannot connect monitor | list(string) | `[]` | no | | cannot\_connect\_extra\_tags | Extra tags for TLS cannot connect monitor | list(string) | `[]` | no |
| cannot\_connect\_last | Parameter 'last' for the service check | string | `"6"` | no |
| cannot\_connect\_message | Custom message for TLS cannot connect monitor | string | `""` | no | | cannot\_connect\_message | Custom message for TLS cannot connect monitor | string | `""` | no |
| cannot\_connect\_no\_data\_timeframe | TLS cannot connect monitor no data timeframe | string | `"10"` | no | | cannot\_connect\_no\_data\_timeframe | TLS cannot connect monitor no data timeframe | string | `"10"` | no |
| cannot\_connect\_threshold\_critical | TLS cannot connect monitor (warning threshold) | string | `"3"` | no | | cannot\_connect\_threshold\_warning | TLS cannot connect monitor (warning threshold) | string | `"3"` | no |
| cannot\_connect\_threshold\_ok | TLS cannot connect monitor (ok threshold) | string | `"3"` | no |
| cannot\_connect\_threshold\_warning | TLS cannot connect monitor (warning threshold) | string | `"2"` | no |
| certificate\_expiration\_date\_enabled | Flag to enable Certificate Expiration Date monitor | string | `"false"` | no | | certificate\_expiration\_date\_enabled | Flag to enable Certificate Expiration Date monitor | string | `"false"` | no |
| certificate\_expiration\_date\_extra\_tags | Extra tags for Certificate Expiration Date monitor | list(string) | `[]` | no | | certificate\_expiration\_date\_extra\_tags | Extra tags for Certificate Expiration Date monitor | list(string) | `[]` | no |
| certificate\_expiration\_date\_message | Custom message for the Certificate Expiration Date monitor | string | `""` | no | | certificate\_expiration\_date\_message | Custom message for the Certificate Expiration Date monitor | string | `""` | no |
@ -47,20 +44,16 @@ Creates DataDog monitors with the following checks:
| filter\_tags\_use\_defaults | Use default filter tags convention | string | `"true"` | no | | filter\_tags\_use\_defaults | Use default filter tags convention | string | `"true"` | no |
| invalid\_tls\_certificate\_enabled | Flag to enable TLS certificate expiration monitor | string | `"true"` | no | | invalid\_tls\_certificate\_enabled | Flag to enable TLS certificate expiration monitor | string | `"true"` | no |
| invalid\_tls\_certificate\_extra\_tags | Extra tags for TLS certificate expiration monitor | list(string) | `[]` | no | | invalid\_tls\_certificate\_extra\_tags | Extra tags for TLS certificate expiration monitor | list(string) | `[]` | no |
| invalid\_tls\_certificate\_last | Parameter 'last' for the service check | string | `"6"` | no |
| invalid\_tls\_certificate\_message | Custom message for TLS certificate expiration monitor | string | `""` | no | | invalid\_tls\_certificate\_message | Custom message for TLS certificate expiration monitor | string | `""` | no |
| invalid\_tls\_certificate\_no\_data\_timeframe | TLS certificate expiration monitor no data timeframe | string | `"10"` | no | | invalid\_tls\_certificate\_no\_data\_timeframe | TLS certificate expiration monitor no data timeframe | string | `"10"` | no |
| invalid\_tls\_certificate\_threshold\_critical | TLS certificate expiration monitor (warning threshold) | string | `"5"` | no | | invalid\_tls\_certificate\_threshold\_warning | TLS certificate expiration monitor (warning threshold) | string | `"3"` | no |
| invalid\_tls\_certificate\_threshold\_warning | TLS certificate expiration monitor (warning threshold) | string | `"5"` | no |
| message | Message sent when an alert is triggered | string | n/a | yes | | message | Message sent when an alert is triggered | string | n/a | yes |
| new\_host\_delay | Delay in seconds before monitor new resource | string | `"300"` | no | | new\_host\_delay | Delay in seconds before monitor new resource | string | `"300"` | no |
| prefix\_slug | Prefix string to prepend between brackets on every monitors names | string | `""` | no | | prefix\_slug | Prefix string to prepend between brackets on every monitors names | string | `""` | no |
| tls\_certificate\_expiration\_enabled | Flag to enable TLS certificate expiration monitor | string | `"true"` | no | | tls\_certificate\_expiration\_enabled | Flag to enable TLS certificate expiration monitor | string | `"true"` | no |
| tls\_certificate\_expiration\_extra\_tags | Extra tags for TLS certificate expiration monitor | list(string) | `[]` | no | | tls\_certificate\_expiration\_extra\_tags | Extra tags for TLS certificate expiration monitor | list(string) | `[]` | no |
| tls\_certificate\_expiration\_last | Parameter 'last' for the service check | string | `"6"` | no |
| tls\_certificate\_expiration\_message | Custom message for TLS certificate expiration monitor | string | `""` | no | | tls\_certificate\_expiration\_message | Custom message for TLS certificate expiration monitor | string | `""` | no |
| tls\_certificate\_expiration\_no\_data\_timeframe | TLS certificate expiration monitor no data timeframe | string | `"10"` | no | | tls\_certificate\_expiration\_no\_data\_timeframe | TLS certificate expiration monitor no data timeframe | string | `"10"` | no |
| tls\_certificate\_expiration\_threshold\_critical | TLS certificate expiration monitor (warning threshold) | string | `"5"` | no |
| tls\_certificate\_expiration\_threshold\_warning | TLS certificate expiration monitor (warning threshold) | string | `"5"` | no | | tls\_certificate\_expiration\_threshold\_warning | TLS certificate expiration monitor (warning threshold) | string | `"5"` | no |
## Outputs ## Outputs

View File

@ -54,27 +54,9 @@ variable "cannot_connect_message" {
default = "" default = ""
} }
variable "cannot_connect_last" {
description = "Parameter 'last' for the service check"
type = string
default = 6
}
variable "cannot_connect_threshold_warning" { variable "cannot_connect_threshold_warning" {
description = "TLS cannot connect monitor (warning threshold)" description = "TLS cannot connect monitor (warning threshold)"
type = string type = string
default = 2
}
variable "cannot_connect_threshold_critical" {
description = "TLS cannot connect monitor (warning threshold)"
type = string
default = 3
}
variable "cannot_connect_threshold_ok" {
description = "TLS cannot connect monitor (ok threshold)"
type = string
default = 3 default = 3
} }
@ -105,22 +87,10 @@ variable "invalid_tls_certificate_message" {
default = "" default = ""
} }
variable "invalid_tls_certificate_last" {
description = "Parameter 'last' for the service check"
type = string
default = 6
}
variable "invalid_tls_certificate_threshold_warning" { variable "invalid_tls_certificate_threshold_warning" {
description = "TLS certificate expiration monitor (warning threshold)" description = "TLS certificate expiration monitor (warning threshold)"
type = string type = string
default = 5 default = 3
}
variable "invalid_tls_certificate_threshold_critical" {
description = "TLS certificate expiration monitor (warning threshold)"
type = string
default = 5
} }
variable "invalid_tls_certificate_no_data_timeframe" { variable "invalid_tls_certificate_no_data_timeframe" {
@ -150,24 +120,12 @@ variable "tls_certificate_expiration_message" {
default = "" default = ""
} }
variable "tls_certificate_expiration_last" {
description = "Parameter 'last' for the service check"
type = string
default = 6
}
variable "tls_certificate_expiration_threshold_warning" { variable "tls_certificate_expiration_threshold_warning" {
description = "TLS certificate expiration monitor (warning threshold)" description = "TLS certificate expiration monitor (warning threshold)"
type = string type = string
default = 5 default = 5
} }
variable "tls_certificate_expiration_threshold_critical" {
description = "TLS certificate expiration monitor (warning threshold)"
type = string
default = 5
}
variable "tls_certificate_expiration_no_data_timeframe" { variable "tls_certificate_expiration_no_data_timeframe" {
description = "TLS certificate expiration monitor no data timeframe" description = "TLS certificate expiration monitor no data timeframe"
type = string type = string

View File

@ -8,13 +8,12 @@ resource "datadog_monitor" "cannot_connect" {
type = "service check" type = "service check"
query = <<EOQ query = <<EOQ
"tls.can_connect"${module.filter-tags.service_check}.by("name","server","port","server_hostname").last(${var.cannot_connect_last}).count_by_status() "tls.can_connect"${module.filter-tags.service_check}.by("name","server","port","server_hostname").last(6).count_by_status()
EOQ EOQ
thresholds = { thresholds = {
warning = var.cannot_connect_threshold_warning warning = var.cannot_connect_threshold_warning
critical = var.cannot_connect_threshold_critical critical = 5
ok = var.cannot_connect_threshold_ok
} }
new_host_delay = var.new_host_delay new_host_delay = var.new_host_delay
@ -44,12 +43,12 @@ resource "datadog_monitor" "invalid_tls_certificate" {
type = "service check" type = "service check"
query = <<EOQ query = <<EOQ
"tls.cert_validation"${module.filter-tags.service_check}.by("name","server","port","server_hostname").last(${var.invalid_tls_certificate_last}).count_by_status() "tls.cert_validation"${module.filter-tags.service_check}.by("name","server","port","server_hostname").last(6).count_by_status()
EOQ EOQ
thresholds = { thresholds = {
warning = var.invalid_tls_certificate_threshold_warning warning = var.invalid_tls_certificate_threshold_warning
critical = var.invalid_tls_certificate_threshold_critical critical = 5
} }
new_host_delay = var.new_host_delay new_host_delay = var.new_host_delay
@ -79,12 +78,12 @@ resource "datadog_monitor" "tls_certificate_expiration" {
type = "service check" type = "service check"
query = <<EOQ query = <<EOQ
"tls.cert_expiration"${module.filter-tags.service_check}.by("name","server","port","server_hostname").last(${var.tls_certificate_expiration_last}).count_by_status() "tls.cert_expiration"${module.filter-tags.service_check}.by("name","server","port","server_hostname").last(6).count_by_status()
EOQ EOQ
thresholds = { thresholds = {
warning = var.tls_certificate_expiration_threshold_warning warning = var.tls_certificate_expiration_threshold_warning
critical = var.tls_certificate_expiration_threshold_critical critical = 5
} }
new_host_delay = var.new_host_delay new_host_delay = var.new_host_delay