MON-226 Standardize filter and split delays
This commit is contained in:
parent
8b3f5f0cff
commit
509f4074f1
@ -23,12 +23,11 @@ Creates DataDog monitors with the following checks:
|
||||
|
||||
| Name | Description | Type | Default | Required |
|
||||
|------|-------------|:----:|:-----:|:-----:|
|
||||
| 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 |
|
||||
| evaluation_delay | Delay in seconds for the metric evaluation | string | `900` | no |
|
||||
| filter_tags | Tags used for filtering | string | `*` | no |
|
||||
| message | Message sent when a monitor is triggered | string | - | yes |
|
||||
| project_id | ID of the GCP Project | string | - | yes |
|
||||
| new_host_delay | Delay in seconds for the new host evaluation | string | `300` | no |
|
||||
| sending_operations_count_extra_tags | Extra tags for GCP Pub/Sub Sending Operations Count monitor | list | `<list>` | no |
|
||||
| sending_operations_count_message | Custom message for the GCP Pub/Sub Sending Operations Count monitor | string | `` | no |
|
||||
| sending_operations_count_silenced | Groups to mute for GCP Pub/Sub Sending Operations Count monitor | map | `<map>` | no |
|
||||
|
||||
@ -6,13 +6,8 @@ variable "environment" {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
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 filtering"
|
||||
default = "*"
|
||||
}
|
||||
|
||||
@ -20,17 +15,14 @@ variable "message" {
|
||||
description = "Message sent when a monitor is triggered"
|
||||
}
|
||||
|
||||
variable "delay" {
|
||||
variable "evaluation_delay" {
|
||||
description = "Delay in seconds for the metric evaluation"
|
||||
default = 900
|
||||
}
|
||||
|
||||
#
|
||||
# Filter variables
|
||||
#
|
||||
variable "project_id" {
|
||||
type = "string"
|
||||
description = "ID of the GCP Project"
|
||||
variable "new_host_delay" {
|
||||
description = "Delay in seconds for the new host evaluation"
|
||||
default = 300
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
@ -1,16 +1,3 @@
|
||||
#
|
||||
# FILTER
|
||||
#
|
||||
data "template_file" "filter" {
|
||||
template = "$${filter}"
|
||||
|
||||
vars {
|
||||
filter = "${var.filter_tags_use_defaults == "true" ?
|
||||
format("project_id:%s", var.project_id) :
|
||||
"${var.filter_tags_custom}"}"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Sending Operations Count
|
||||
#
|
||||
@ -22,7 +9,7 @@ resource "datadog_monitor" "sending_operations_count" {
|
||||
|
||||
query = <<EOF
|
||||
${var.sending_operations_count_time_aggregator}(${var.sending_operations_count_timeframe}):
|
||||
default(avg:gcp.pubsub.topic.send_message_operation_count{${data.template_file.filter.rendered}} by {topic_id}.as_count(), 0)
|
||||
default(avg:gcp.pubsub.topic.send_message_operation_count{${var.filter_tags}} by {topic_id}.as_count(), 0)
|
||||
<= ${var.sending_operations_count_threshold_critical}
|
||||
EOF
|
||||
|
||||
@ -38,8 +25,8 @@ EOF
|
||||
notify_no_data = true
|
||||
renotify_interval = 0
|
||||
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
silenced = "${var.sending_operations_count_silenced}"
|
||||
|
||||
@ -64,7 +51,7 @@ resource "datadog_monitor" "unavailable_sending_operations_count" {
|
||||
|
||||
query = <<EOF
|
||||
${var.unavailable_sending_operations_count_time_aggregator}(${var.unavailable_sending_operations_count_timeframe}):
|
||||
default(avg:gcp.pubsub.topic.send_message_operation_count{${data.template_file.filter.rendered},response_code:unavailable} by {topic_id}.as_count(), 0)
|
||||
default(avg:gcp.pubsub.topic.send_message_operation_count{${var.filter_tags},response_code:unavailable} by {topic_id}.as_count(), 0)
|
||||
>= ${var.unavailable_sending_operations_count_threshold_critical}
|
||||
EOF
|
||||
|
||||
@ -81,8 +68,8 @@ EOF
|
||||
notify_no_data = true
|
||||
renotify_interval = 0
|
||||
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
silenced = "${var.unavailable_sending_operations_count_silenced}"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user