MON-91 Monitor with VPN tunnel scope and remove custom metrics tags since they are not fetched
This commit is contained in:
parent
fc0f342593
commit
339471b027
@ -16,7 +16,7 @@ module "datadog-monitors-cloud-aws-vpn" {
|
||||
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- VPN Down
|
||||
- VPN tunnel down
|
||||
|
||||
## Inputs
|
||||
|
||||
@ -24,8 +24,7 @@ Creates DataDog monitors with the following checks:
|
||||
|------|-------------|:----:|:-----:|:-----:|
|
||||
| delay | Delay in seconds for the metric evaluation | string | `900` | no |
|
||||
| environment | Architecture Environment | string | - | yes |
|
||||
| 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 | `true` | no |
|
||||
| filter_tags | Tags used for metrics filtering | string | `*` | no |
|
||||
| message | Message sent when an alert is triggered | string | - | yes |
|
||||
| vpn_status_message | Custom message for VPN status monitor | string | `` | no |
|
||||
| vpn_status_silenced | Groups to mute for VPN status monitor | map | `<map>` | no |
|
||||
|
||||
@ -14,13 +14,8 @@ 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"
|
||||
variable "filter_tags" {
|
||||
description = "Tags used for metrics filtering"
|
||||
default = "*"
|
||||
}
|
||||
|
||||
|
||||
@ -1,18 +1,10 @@
|
||||
data "template_file" "filter" {
|
||||
template = "$${filter}"
|
||||
|
||||
vars {
|
||||
filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_aws_vpn:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}"
|
||||
}
|
||||
}
|
||||
|
||||
resource "datadog_monitor" "VPN_status" {
|
||||
name = "[${var.environment}] VPN Down"
|
||||
name = "[${var.environment}] VPN tunnel down"
|
||||
message = "${coalesce(var.vpn_status_message, var.message)}"
|
||||
|
||||
query = <<EOF
|
||||
${var.vpn_status_time_aggregator}(${var.vpn_status_timeframe}): (
|
||||
avg:aws.vpn.tunnel_state{${data.template_file.filter.rendered}} by {region,name}
|
||||
min:aws.vpn.tunnel_state{${var.filter_tags}} by {region,tunnelipaddress}
|
||||
) < 1
|
||||
EOF
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user