MON-91 - Update query monitor
This commit is contained in:
parent
e94ae0dcb7
commit
14954200f0
@ -26,8 +26,6 @@ Inputs
|
|||||||
|------|-------------|:----:|:-----:|:-----:|
|
|------|-------------|:----:|:-----:|:-----:|
|
||||||
| environment | Architecture Environment | string | - | yes |
|
| environment | Architecture Environment | string | - | yes |
|
||||||
| evaluation_delay | Delay in seconds for the metric evaluation | string | `600` | no |
|
| evaluation_delay | Delay in seconds for the metric evaluation | string | `600` | 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 | `true` | no |
|
||||||
| message | Message sent when an alert is triggered | string | - | yes |
|
| message | Message sent when an alert is triggered | string | - | yes |
|
||||||
| vpn_status_critical | Both tunnels are down | string | `0` | no |
|
|
||||||
| vpn_status_ok | Both tunnels are up, everything is ok | string | `2` | no |
|
|
||||||
| vpn_status_warning | Only one tunnel is up | string | `1` | no |
|
|
||||||
| vpn_tunnel_address | List the VPN tunnels you want to monitor | list | `<list>` | no |
|
|
||||||
|
|||||||
@ -14,24 +14,12 @@ variable "message" {
|
|||||||
description = "Message sent when an alert is triggered"
|
description = "Message sent when an alert is triggered"
|
||||||
}
|
}
|
||||||
|
|
||||||
# AWS VPN Service specific
|
variable "filter_tags_use_defaults" {
|
||||||
variable "vpn_tunnel_address" {
|
description = "Use default filter tags convention"
|
||||||
description = "List the VPN tunnels you want to monitor"
|
default = "true"
|
||||||
type = "list"
|
|
||||||
default = []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "vpn_status_ok" {
|
variable "filter_tags_custom" {
|
||||||
description = "Both tunnels are up, everything is ok"
|
description = "Tags used for custom filtering when filter_tags_use_defaults is false"
|
||||||
default = 2
|
default = "*"
|
||||||
}
|
|
||||||
|
|
||||||
variable "vpn_status_warning" {
|
|
||||||
description = "Only one tunnel is up"
|
|
||||||
default = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "vpn_status_critical" {
|
|
||||||
description = "Both tunnels are down"
|
|
||||||
default = 0
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,22 +1,23 @@
|
|||||||
|
data "template_file" "filter" {
|
||||||
|
template = "$${filter}"
|
||||||
|
|
||||||
|
vars {
|
||||||
|
filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_aws_elb:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
resource "datadog_monitor" "VPN_status" {
|
resource "datadog_monitor" "VPN_status" {
|
||||||
name = "[${var.environment}] VPN Down {{ tunnelipaddress }}"
|
name = "[${var.environment}] VPN Down {{ tunnelipaddress }}"
|
||||||
message = "${var.message}"
|
message = "${var.message}"
|
||||||
|
|
||||||
query = <<EOF
|
query = <<EOF
|
||||||
avg(last_5m): (
|
avg(last_5m): (
|
||||||
avg:aws.vpn.tunnel_state{tunnelipaddress:${var.vpn_tunnel_address[0]}} by {region,name}
|
avg:aws.vpn.tunnel_state{${data.template_file.filter.rendered}} by {region,name}
|
||||||
+ avg:aws.vpn.tunnel_state{tunnelipaddress:${var.vpn_tunnel_address[1]}} by {region,name}
|
) < 1
|
||||||
) == ${var.vpn_status_critical}
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
type = "metric alert"
|
type = "metric alert"
|
||||||
|
|
||||||
thresholds {
|
|
||||||
ok = "${var.vpn_status_ok}"
|
|
||||||
warning = "${var.vpn_status_warning}"
|
|
||||||
critical = "${var.vpn_status_critical}"
|
|
||||||
}
|
|
||||||
|
|
||||||
notify_no_data = true
|
notify_no_data = true
|
||||||
renotify_interval = 0
|
renotify_interval = 0
|
||||||
evaluation_delay = "${var.evaluation_delay}"
|
evaluation_delay = "${var.evaluation_delay}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user