MON-77 add tags and subscription_id

This commit is contained in:
Quentin Manfroi 2017-11-03 20:41:57 +01:00 committed by Laurent Piroelle
parent 0f22d51e9c
commit 9e55ce3772
3 changed files with 40 additions and 10 deletions

View File

@ -9,8 +9,8 @@ module "datadog-monitors-azure-eventhub" {
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/azure/eventhub?ref={revision}"
message = "${module.datadog-message-alerting.alerting-message}"
environment = "${var.environment}"
subscription_id = "${var.subscription_id}"
}
```
@ -29,12 +29,15 @@ Inputs
|------|-------------|:----:|:-----:|:-----:|
| delay | Delay in seconds for the metric evaluation | string | `600` | no |
| environment | Architecture environment | string | - | yes |
| provider | What is the monitored provider | string | - | yes |
| service | What is the monitored service | string | - | yes |
| errors_rate_thresold_critical | Errors ratio (percentage) to trigger the critical alert | string | `3` | no |
| errors_rate_thresold_warning | Errors ratio (percentage) to trigger a warning alert | string | `1` | no |
| failed_requests_rate_thresold_critical | Failed requests ratio (percentage) to trigger the critical alert | string | `3` | no |
| failed_requests_rate_thresold_warning | Failed requests ratio (percentage) to trigger a warning alert | string | `1` | no |
| message | Message sent when an alert is triggered | string | - | yes |
| use_filter_tags | Filter the data with service tags if true | string | `true` | no |
| subscription_id | Azure account id used as filter for monitors | string | - | yes |
Outputs
-------

View File

@ -1,5 +1,27 @@
variable "environment" {}
# Global Terraform
variable "environment" {
description = "Architecture environment"
type = "string"
}
variable "subscription_id" {
description = "Azure account id used as filter for monitors"
type = "string"
}
variable "provider" {
description = "Cloud provider which the monitor and its based metric depend on"
type = "string"
default = "azure"
}
variable "service" {
description = "Service monitored by this set of monitors"
type = "string"
default = "storage"
}
# Global DataDog
variable "message" {
description = "Message sent when an alert is triggered"
}
@ -9,6 +31,11 @@ variable "delay" {
default = 600
}
variable "use_filter_tags" {
description = "Filter the data with service tags if true"
default = "true"
}
variable "failed_requests_rate_thresold_critical" {
description = "Failed requests ratio (percentage) to trigger the critical alert"
default = 3
@ -28,8 +55,3 @@ variable "errors_rate_thresold_warning" {
description = "Errors ratio (percentage) to trigger a warning alert"
default = 1
}
variable "use_filter_tags" {
description = "Filter the data with service tags if true"
default = "true"
}

View File

@ -2,11 +2,10 @@ data "template_file" "filter" {
template = "$${filter}"
vars {
filter = "${var.use_filter_tags == "true" ? format("dd_monitoring:enabled,dd_azure_eventhub:enabled,env:%s", var.environment) : "*"}"
filter = "${var.use_filter_tags == "true" ? format("dd_monitoring:enabled,dd_azure_storage:enabled,env:%s", var.environment) : "subscription_id:${var.subscription_id}"}"
}
}
resource "datadog_monitor" "eventhub_status" {
name = "[${var.environment}] Event Hub status"
message = "${var.message}"
@ -26,6 +25,8 @@ resource "datadog_monitor" "eventhub_status" {
require_full_window = true
new_host_delay = "${var.delay}"
no_data_timeframe = 20
tags = ["env:${var.environment}","resource:${var.service}","team:${var.provider}"]
}
resource "datadog_monitor" "eventhub_failed_requests" {
@ -57,6 +58,8 @@ resource "datadog_monitor" "eventhub_failed_requests" {
require_full_window = true
new_host_delay = "${var.delay}"
no_data_timeframe = 20
tags = ["env:${var.environment}","resource:${var.service}","team:${var.provider}"]
}
resource "datadog_monitor" "eventhub_errors" {
@ -91,5 +94,7 @@ resource "datadog_monitor" "eventhub_errors" {
locked = false
require_full_window = true
new_host_delay = "${var.delay}"
no_data_timeframe = 20
no_data_timeframe = 20o
tags = ["env:${var.environment}","resource:${var.service}","team:${var.provider}"]
}