Merged in MON-91-added-aws-vpn-state-check (pull request #32)
MON-91 Added VPN state check Approved-by: Ahmed Fourti <ahmed.fourti@fr.clara.net> Approved-by: Quentin Manfroi <quentin.manfroi@yahoo.fr> Approved-by: Alexandre Gaillet <alexandre.gaillet@fr.clara.net> Approved-by: Adrien Broyere <adrien.broyere@fr.clara.net>
This commit is contained in:
commit
98af0843d5
31
cloud/aws/vpn/README.md
Normal file
31
cloud/aws/vpn/README.md
Normal file
@ -0,0 +1,31 @@
|
||||
AWS VPN DataDog monitors
|
||||
===============================
|
||||
|
||||
How to use this module
|
||||
----------------------
|
||||
|
||||
```
|
||||
module "vpn" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/aws/vpn?ref=MON-91-added-aws-vpn-state-check"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
vpn_tunnel_address = "${var.vpn_to_monitor}"
|
||||
}
|
||||
```
|
||||
|
||||
Purpose
|
||||
-------
|
||||
Creates a DataDog monitors with the following checks :
|
||||
* VPN status
|
||||
|
||||
Inputs
|
||||
-------
|
||||
|
||||
| Name | Description | Type | Default | Required |
|
||||
|------|-------------|:----:|:-----:|:-----:|
|
||||
| environment | Architecture Environment | string | - | yes |
|
||||
| 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 |
|
||||
25
cloud/aws/vpn/inputs.tf
Normal file
25
cloud/aws/vpn/inputs.tf
Normal file
@ -0,0 +1,25 @@
|
||||
# Global Terraform
|
||||
variable "environment" {
|
||||
description = "Architecture Environment"
|
||||
type = "string"
|
||||
}
|
||||
|
||||
# Global DataDog
|
||||
variable "evaluation_delay" {
|
||||
description = "Delay in seconds for the metric evaluation"
|
||||
default = 600
|
||||
}
|
||||
|
||||
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 = "*"
|
||||
}
|
||||
31
cloud/aws/vpn/monitors-vpn.tf
Normal file
31
cloud/aws/vpn/monitors-vpn.tf
Normal file
@ -0,0 +1,31 @@
|
||||
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"
|
||||
message = "${var.message}"
|
||||
|
||||
query = <<EOF
|
||||
avg(last_5m): (
|
||||
avg:aws.vpn.tunnel_state{${data.template_file.filter.rendered}} by {region,name}
|
||||
) < 1
|
||||
EOF
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
notify_no_data = true
|
||||
renotify_interval = 0
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
new_host_delay = "${var.evaluation_delay}"
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
include_tags = true
|
||||
require_full_window = false
|
||||
|
||||
tags = ["env: ${var.environment}", "resource:vpn", "team:aws", "provider:aws"]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user