MON-91 Added VPN state check

This commit is contained in:
Ahmed Fourti 2017-11-30 11:00:58 +01:00 committed by Alexandre Gaillet
parent b53e5fa34e
commit fa9a5c3b3d
3 changed files with 63 additions and 1 deletions

1
cloud/aws/vpn/inputs.tf Symbolic link
View File

@ -0,0 +1 @@
../../../inputs.tf

View File

@ -0,0 +1,36 @@
module "message" {
source = "../../common/alerting-message"
oncall_24x7 = "${var.hno_escalation_group}"
oncall_office_hours = "${var.ho_escalation_group}"
}
resource "datadog_monitor" "VPN_status" {
name = "[${var.env}] VPN Down {{ tunnelipaddress }}"
message = "${module.message.alerting-message}"
query = <<EOF
avg(last_5m): (
avg:aws.vpn.tunnel_state{tunnelipaddress:${var.vpn_tunnel_address[0]}} by {region}
+ avg:aws.vpn.tunnel_state{tunnelipaddress:${var.vpn_tunnel_address[1]}} by {region}
) == ${var.vpn_config["critical"]}
EOF
type = "query alert"
thresholds {
ok = "${var.vpn_config["ok"]}"
critical = "${var.vpn_config["critical"]}"
warning = "${var.vpn_config["warning"]}"
}
notify_no_data = true
renotify_interval = 15
evaluation_delay = "${var.vpn_config["delay"]}"
notify_audit = false
timeout_h = 0
include_tags = true
locked = false
require_full_window = true
tags = ["env: ${var.env}", "provider: aws", "resource: vpn"]
}

View File

@ -60,6 +60,8 @@ variable "rds_cpu_threshold" {
} }
variable "rds_mem_threshold" { variable "rds_mem_threshold" {
type = "map"
default = { default = {
warning = 20 warning = 20
critical = 10 critical = 10
@ -81,6 +83,8 @@ variable "elb_config" {
} }
variable "elb_5xx_threshold" { variable "elb_5xx_threshold" {
type = "map"
default = { default = {
warning = 5 warning = 5
critical = 10 critical = 10
@ -88,6 +92,8 @@ variable "elb_5xx_threshold" {
} }
variable "elb_4xx_threshold" { variable "elb_4xx_threshold" {
type = "map"
default = { default = {
warning = 5 warning = 5
critical = 10 critical = 10
@ -96,13 +102,32 @@ variable "elb_4xx_threshold" {
variable "elb_backend_latency" { variable "elb_backend_latency" {
description = "Average time elapsed after the request leaves the load balancer until a response is received. In seconds" description = "Average time elapsed after the request leaves the load balancer until a response is received. In seconds"
default = { default = {
warning = 1 warning = 1
critical = 5 critical = 5
} }
} }
## VPN
variable "vpn_tunnel_address" {
description = "List the VPN tunnels you want to monitor"
type = "list"
default = []
}
variable "vpn_config" {
description = "Ok means that both tunnels are up, warning means only one tunnel is up and critical means that both tunnels are down "
type = "map"
default = {
delay = 900
warning = 1
critical = 0
ok = 2
}
}
##apache nginx php ##apache nginx php
variable "dd_nginx" { variable "dd_nginx" {
default = "disabled" default = "disabled"