MON-499 HTTP monitors now in two modules: webcheck and ssl. Critical threshold for SSL and TLS monitors on metric are now 15 days.
This commit is contained in:
parent
00e2104623
commit
ac5b9e3262
@ -203,6 +203,8 @@ The `//` is very important, it's a terraform specific syntax used to separate gi
|
||||
- [network](https://git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors/tree/master/network/)
|
||||
- [dns](https://git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors/tree/master/network/dns/)
|
||||
- [http](https://git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors/tree/master/network/http/)
|
||||
- [ssl](https://git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors/tree/master/network/http/ssl/)
|
||||
- [webcheck](https://git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors/tree/master/network/http/webcheck/)
|
||||
- [tls](https://git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors/tree/master/network/tls/)
|
||||
- [saas](https://git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors/tree/master/saas/)
|
||||
- [new-relic](https://git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors/tree/master/saas/new-relic/)
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
# NETWORK HTTP DataDog monitors
|
||||
# NETWORK HTTP SSL DataDog monitors
|
||||
|
||||
## How to use this module
|
||||
|
||||
```
|
||||
module "datadog-monitors-network-http" {
|
||||
source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//network/http?ref={revision}"
|
||||
module "datadog-monitors-network-http-ssl" {
|
||||
source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//network/http/ssl?ref={revision}"
|
||||
|
||||
environment = var.environment
|
||||
message = module.datadog-message-alerting.alerting-message
|
||||
@ -16,7 +16,6 @@ module "datadog-monitors-network-http" {
|
||||
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- HTTP cannot connect
|
||||
- SSL certificate expiration (disabled by default)
|
||||
- SSL invalid certificate
|
||||
|
||||
@ -24,18 +23,10 @@ Creates DataDog monitors with the following checks:
|
||||
|
||||
| Name | Description | Type | Default | Required |
|
||||
|------|-------------|:----:|:-----:|:-----:|
|
||||
| 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\_last | Parameter 'last' for the service check | string | `"6"` | 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\_threshold\_critical | 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 |
|
||||
| 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\_message | Custom message for the Certificate Expiration Date monitor | string | `""` | no |
|
||||
| certificate\_expiration\_date\_threshold\_critical | Certificate Expiration Date critical threshold | string | `"8"` | no |
|
||||
| certificate\_expiration\_date\_threshold\_critical | Certificate Expiration Date critical threshold | string | `"15"` | no |
|
||||
| certificate\_expiration\_date\_threshold\_warning | Certificate Expiration Date warning threshold | string | `"30"` | no |
|
||||
| certificate\_expiration\_date\_time\_aggregator | Time aggregator for the Certificate Expiration Date monitor | string | `"max"` | no |
|
||||
| certificate\_expiration\_date\_timeframe | Timeframe for the Certificate Expiration Date monitor | string | `"last_5m"` | no |
|
||||
@ -59,10 +50,8 @@ Creates DataDog monitors with the following checks:
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
| cannot\_connect\_id | id for monitor cannot_connect |
|
||||
| certificate\_expiration\_date\_id | id for monitor certificate_expiration_date |
|
||||
| invalid\_ssl\_certificate\_id | id for monitor invalid_ssl_certificate |
|
||||
|
||||
## Related documentation
|
||||
|
||||
- [Datadog HTTP integration](https://docs.datadoghq.com/integrations/http_check/)
|
||||
@ -39,57 +39,6 @@ variable "filter_tags_custom_excluded" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
#
|
||||
# HTTP Cannot Connect
|
||||
#
|
||||
variable "cannot_connect_enabled" {
|
||||
description = "Flag to enable HTTP cannot connect monitor"
|
||||
type = string
|
||||
default = "true"
|
||||
}
|
||||
|
||||
variable "cannot_connect_message" {
|
||||
description = "Custom message for HTTP cannot connect monitor"
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "cannot_connect_last" {
|
||||
description = "Parameter 'last' for the service check"
|
||||
type = string
|
||||
default = 6
|
||||
}
|
||||
|
||||
variable "cannot_connect_threshold_warning" {
|
||||
description = "HTTP cannot connect monitor (warning threshold)"
|
||||
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
|
||||
}
|
||||
|
||||
variable "cannot_connect_no_data_timeframe" {
|
||||
description = "HTTP cannot connect monitor no data timeframe"
|
||||
type = string
|
||||
default = 10
|
||||
}
|
||||
|
||||
variable "cannot_connect_extra_tags" {
|
||||
description = "Extra tags for HTTP cannot connect monitor"
|
||||
type = list(string)
|
||||
default = []
|
||||
}
|
||||
|
||||
#
|
||||
# SSL invalid certificate
|
||||
#
|
||||
@ -171,11 +120,11 @@ variable "certificate_expiration_date_threshold_warning" {
|
||||
variable "certificate_expiration_date_threshold_critical" {
|
||||
description = "Certificate Expiration Date critical threshold"
|
||||
type = string
|
||||
default = 8
|
||||
default = 15
|
||||
}
|
||||
|
||||
variable "certificate_expiration_date_extra_tags" {
|
||||
description = "Extra tags for Certificate Expiration Date monitor"
|
||||
type = list(string)
|
||||
default = []
|
||||
}
|
||||
}
|
||||
@ -1,39 +1,3 @@
|
||||
#
|
||||
# HTTP Cannot Connect
|
||||
#
|
||||
resource "datadog_monitor" "cannot_connect" {
|
||||
count = var.cannot_connect_enabled == "true" ? 1 : 0
|
||||
name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] HTTP cannot connect"
|
||||
message = coalesce(var.cannot_connect_message, var.message)
|
||||
type = "service check"
|
||||
|
||||
query = <<EOQ
|
||||
"http.can_connect"${module.filter-tags.service_check}.by("instance","url").last(${var.cannot_connect_last}).count_by_status()
|
||||
EOQ
|
||||
|
||||
thresholds = {
|
||||
warning = var.cannot_connect_threshold_warning
|
||||
critical = var.cannot_connect_threshold_critical
|
||||
ok = var.cannot_connect_threshold_ok
|
||||
}
|
||||
|
||||
new_host_delay = var.new_host_delay
|
||||
no_data_timeframe = var.cannot_connect_no_data_timeframe
|
||||
notify_no_data = true
|
||||
notify_audit = false
|
||||
locked = false
|
||||
timeout_h = 0
|
||||
include_tags = true
|
||||
require_full_window = true
|
||||
renotify_interval = 0
|
||||
|
||||
tags = concat(["env:${var.environment}", "type:network", "provider:http_check", "resource:webcheck", "team:claranet", "created-by:terraform"], var.cannot_connect_extra_tags)
|
||||
|
||||
lifecycle {
|
||||
ignore_changes = ["silenced"]
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Invalid SSL Certificate
|
||||
#
|
||||
@ -1,6 +1,6 @@
|
||||
output "cannot_connect_id" {
|
||||
description = "id for monitor cannot_connect"
|
||||
value = datadog_monitor.cannot_connect.*.id
|
||||
output "certificate_expiration_date_id" {
|
||||
description = "id for monitor certificate_expiration_date"
|
||||
value = datadog_monitor.certificate_expiration_date.*.id
|
||||
}
|
||||
|
||||
output "invalid_ssl_certificate_id" {
|
||||
@ -8,8 +8,3 @@ output "invalid_ssl_certificate_id" {
|
||||
value = datadog_monitor.invalid_ssl_certificate.*.id
|
||||
}
|
||||
|
||||
output "certificate_expiration_date_id" {
|
||||
description = "id for monitor certificate_expiration_date"
|
||||
value = datadog_monitor.certificate_expiration_date.*.id
|
||||
}
|
||||
|
||||
49
network/http/webcheck/README.md
Normal file
49
network/http/webcheck/README.md
Normal file
@ -0,0 +1,49 @@
|
||||
# NETWORK HTTP WEBCHECK DataDog monitors
|
||||
|
||||
## How to use this module
|
||||
|
||||
```
|
||||
module "datadog-monitors-network-http-webcheck" {
|
||||
source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//network/http/webcheck?ref={revision}"
|
||||
|
||||
environment = var.environment
|
||||
message = module.datadog-message-alerting.alerting-message
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- HTTP cannot connect
|
||||
|
||||
## Inputs
|
||||
|
||||
| Name | Description | Type | Default | Required |
|
||||
|------|-------------|:----:|:-----:|:-----:|
|
||||
| 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\_last | Parameter 'last' for the service check | string | `"6"` | 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\_threshold\_critical | 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 |
|
||||
| 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\_excluded | Tags excluded for custom filtering when filter_tags_use_defaults is false | string | `""` | no |
|
||||
| filter\_tags\_use\_defaults | Use default filter tags convention | string | `"true"` | no |
|
||||
| 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 |
|
||||
| prefix\_slug | Prefix string to prepend between brackets on every monitors names | string | `""` | no |
|
||||
|
||||
## Outputs
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
| cannot\_connect\_id | id for monitor cannot_connect |
|
||||
|
||||
## Related documentation
|
||||
|
||||
91
network/http/webcheck/inputs.tf
Normal file
91
network/http/webcheck/inputs.tf
Normal file
@ -0,0 +1,91 @@
|
||||
# Global Terraform
|
||||
variable "environment" {
|
||||
description = "Architecture Environment"
|
||||
type = string
|
||||
}
|
||||
|
||||
# Global DataDog
|
||||
variable "evaluation_delay" {
|
||||
description = "Delay in seconds for the metric evaluation"
|
||||
default = 15
|
||||
}
|
||||
|
||||
variable "new_host_delay" {
|
||||
description = "Delay in seconds before monitor new resource"
|
||||
default = 300
|
||||
}
|
||||
|
||||
variable "prefix_slug" {
|
||||
description = "Prefix string to prepend between brackets on every monitors names"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "message" {
|
||||
description = "Message sent when an alert is triggered"
|
||||
}
|
||||
|
||||
variable "filter_tags_use_defaults" {
|
||||
description = "Use default filter tags convention"
|
||||
default = "true"
|
||||
}
|
||||
|
||||
variable "filter_tags_custom" {
|
||||
description = "Tags used for custom filtering when filter_tags_use_defaults is false"
|
||||
default = "*"
|
||||
}
|
||||
|
||||
variable "filter_tags_custom_excluded" {
|
||||
description = "Tags excluded for custom filtering when filter_tags_use_defaults is false"
|
||||
default = ""
|
||||
}
|
||||
|
||||
#
|
||||
# HTTP Cannot Connect
|
||||
#
|
||||
variable "cannot_connect_enabled" {
|
||||
description = "Flag to enable HTTP cannot connect monitor"
|
||||
type = string
|
||||
default = "true"
|
||||
}
|
||||
|
||||
variable "cannot_connect_message" {
|
||||
description = "Custom message for HTTP cannot connect monitor"
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "cannot_connect_last" {
|
||||
description = "Parameter 'last' for the service check"
|
||||
type = string
|
||||
default = 6
|
||||
}
|
||||
|
||||
variable "cannot_connect_threshold_warning" {
|
||||
description = "HTTP cannot connect monitor (warning threshold)"
|
||||
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
|
||||
}
|
||||
|
||||
variable "cannot_connect_no_data_timeframe" {
|
||||
description = "HTTP cannot connect monitor no data timeframe"
|
||||
type = string
|
||||
default = 10
|
||||
}
|
||||
|
||||
variable "cannot_connect_extra_tags" {
|
||||
description = "Extra tags for HTTP cannot connect monitor"
|
||||
type = list(string)
|
||||
default = []
|
||||
}
|
||||
9
network/http/webcheck/modules.tf
Normal file
9
network/http/webcheck/modules.tf
Normal file
@ -0,0 +1,9 @@
|
||||
module "filter-tags" {
|
||||
source = "../../common/filter-tags"
|
||||
|
||||
environment = var.environment
|
||||
resource = "http"
|
||||
filter_tags_use_defaults = var.filter_tags_use_defaults
|
||||
filter_tags_custom = var.filter_tags_custom
|
||||
filter_tags_custom_excluded = var.filter_tags_custom_excluded
|
||||
}
|
||||
35
network/http/webcheck/monitors-webcheck.tf
Normal file
35
network/http/webcheck/monitors-webcheck.tf
Normal file
@ -0,0 +1,35 @@
|
||||
#
|
||||
# HTTP Cannot Connect
|
||||
#
|
||||
resource "datadog_monitor" "cannot_connect" {
|
||||
count = var.cannot_connect_enabled == "true" ? 1 : 0
|
||||
name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] HTTP cannot connect"
|
||||
message = coalesce(var.cannot_connect_message, var.message)
|
||||
type = "service check"
|
||||
|
||||
query = <<EOQ
|
||||
"http.can_connect"${module.filter-tags.service_check}.by("instance","url").last(${var.cannot_connect_last}).count_by_status()
|
||||
EOQ
|
||||
|
||||
thresholds = {
|
||||
warning = var.cannot_connect_threshold_warning
|
||||
critical = var.cannot_connect_threshold_critical
|
||||
ok = var.cannot_connect_threshold_ok
|
||||
}
|
||||
|
||||
new_host_delay = var.new_host_delay
|
||||
no_data_timeframe = var.cannot_connect_no_data_timeframe
|
||||
notify_no_data = true
|
||||
notify_audit = false
|
||||
locked = false
|
||||
timeout_h = 0
|
||||
include_tags = true
|
||||
require_full_window = true
|
||||
renotify_interval = 0
|
||||
|
||||
tags = concat(["env:${var.environment}", "type:network", "provider:http_check", "resource:webcheck", "team:claranet", "created-by:terraform"], var.cannot_connect_extra_tags)
|
||||
|
||||
lifecycle {
|
||||
ignore_changes = ["silenced"]
|
||||
}
|
||||
}
|
||||
5
network/http/webcheck/outputs.tf
Normal file
5
network/http/webcheck/outputs.tf
Normal file
@ -0,0 +1,5 @@
|
||||
output "cannot_connect_id" {
|
||||
description = "id for monitor cannot_connect"
|
||||
value = datadog_monitor.cannot_connect.*.id
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ Creates DataDog monitors with the following checks:
|
||||
| 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\_message | Custom message for the Certificate Expiration Date monitor | string | `""` | no |
|
||||
| certificate\_expiration\_date\_threshold\_critical | Container Memory Usage critical threshold | string | `"8"` | no |
|
||||
| certificate\_expiration\_date\_threshold\_critical | Container Memory Usage critical threshold | string | `"15"` | no |
|
||||
| certificate\_expiration\_date\_threshold\_warning | Container Memory Usage warning threshold | string | `"30"` | no |
|
||||
| certificate\_expiration\_date\_time\_aggregator | Time aggregator for the Certificate Expiration Date monitor | string | `"max"` | no |
|
||||
| certificate\_expiration\_date\_timeframe | Timeframe for the Certificate Expiration Date monitor | string | `"last_5m"` | no |
|
||||
|
||||
@ -216,7 +216,7 @@ variable "certificate_expiration_date_threshold_warning" {
|
||||
variable "certificate_expiration_date_threshold_critical" {
|
||||
description = "Container Memory Usage critical threshold"
|
||||
type = string
|
||||
default = 8
|
||||
default = 15
|
||||
}
|
||||
|
||||
variable "certificate_expiration_date_extra_tags" {
|
||||
|
||||
@ -3,6 +3,11 @@ output "cannot_connect_id" {
|
||||
value = datadog_monitor.cannot_connect.*.id
|
||||
}
|
||||
|
||||
output "certificate_expiration_date_id" {
|
||||
description = "id for monitor certificate_expiration_date"
|
||||
value = datadog_monitor.certificate_expiration_date.*.id
|
||||
}
|
||||
|
||||
output "invalid_tls_certificate_id" {
|
||||
description = "id for monitor invalid_tls_certificate"
|
||||
value = datadog_monitor.invalid_tls_certificate.*.id
|
||||
@ -13,8 +18,3 @@ output "tls_certificate_expiration_id" {
|
||||
value = datadog_monitor.tls_certificate_expiration.*.id
|
||||
}
|
||||
|
||||
output "certificate_expiration_date_id" {
|
||||
description = "id for monitor certificate_expiration_date"
|
||||
value = datadog_monitor.certificate_expiration_date.*.id
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user