MON-224 Standardize filter
This commit is contained in:
parent
d6bdc2c586
commit
eae2eeba30
@ -62,8 +62,7 @@ Creates DataDog monitors with the following checks:
|
||||
| failover_unavailable_threshold_critical | Failover Unavailable critical threshold | string | `0` | no |
|
||||
| failover_unavailable_time_aggregator | Time aggreggator for the Failover Unavailable monitor | string | `max` | no |
|
||||
| failover_unavailable_timeframe | Timeframe for the Failover Unavailable monitor | string | `last_5m` | 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 |
|
||||
| filter_tags | Tags used for filtering | string | `*` | no |
|
||||
| memory_utilization_extra_tags | Extra tags for GCP Cloud SQL Memory Utilization monitor | list | `<list>` | no |
|
||||
| memory_utilization_forecast_algorithm | Algorithm for the Memory Utilization Forecast monitor | string | `linear` | no |
|
||||
| memory_utilization_forecast_deviations | Deviations for the Memory Utilization Forecast monitor | string | `1` | no |
|
||||
@ -86,7 +85,6 @@ Creates DataDog monitors with the following checks:
|
||||
| memory_utilization_timeframe | Timeframe for the Memory Utilization monitor | string | `last_5m` | no |
|
||||
| message | Message sent when a monitor is triggered | string | - | yes |
|
||||
| new_host_delay | Delay in seconds for the new host evaluation | string | `300` | no |
|
||||
| project_id | ID of the GCP Project | string | - | yes |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
||||
@ -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 = "*"
|
||||
}
|
||||
|
||||
@ -30,14 +25,6 @@ variable "new_host_delay" {
|
||||
default = 300
|
||||
}
|
||||
|
||||
#
|
||||
# Filter variables
|
||||
#
|
||||
variable "project_id" {
|
||||
type = "string"
|
||||
description = "ID of the GCP Project"
|
||||
}
|
||||
|
||||
#
|
||||
# CPU
|
||||
#
|
||||
|
||||
@ -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}"}"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# CPU Utilization
|
||||
#
|
||||
@ -22,7 +9,7 @@ resource "datadog_monitor" "cpu_utilization" {
|
||||
|
||||
query = <<EOF
|
||||
${var.cpu_utilization_time_aggregator}(${var.cpu_utilization_timeframe}):
|
||||
avg:gcp.cloudsql.database.cpu.utilization{${data.template_file.filter.rendered}}
|
||||
avg:gcp.cloudsql.database.cpu.utilization{${var.filter_tags}}}
|
||||
by {database_id} * 100
|
||||
> ${var.cpu_utilization_threshold_critical}
|
||||
EOF
|
||||
@ -66,7 +53,7 @@ resource "datadog_monitor" "disk_utilization" {
|
||||
|
||||
query = <<EOF
|
||||
${var.disk_utilization_time_aggregator}(${var.disk_utilization_timeframe}):
|
||||
avg:gcp.cloudsql.database.disk.utilization{${data.template_file.filter.rendered}}
|
||||
avg:gcp.cloudsql.database.disk.utilization{${var.filter_tags}}}
|
||||
by {database_id} * 100
|
||||
> ${var.disk_utilization_threshold_critical}
|
||||
EOF
|
||||
@ -111,7 +98,7 @@ resource "datadog_monitor" "disk_utilization_forecast" {
|
||||
query = <<EOF
|
||||
${var.disk_utilization_forecast_time_aggregator}(${var.disk_utilization_forecast_timeframe}):
|
||||
forecast(
|
||||
avg:gcp.cloudsql.database.disk.utilization{${data.template_file.filter.rendered}} by {database_id} * 100,
|
||||
avg:gcp.cloudsql.database.disk.utilization{${var.filter_tags}}} by {database_id} * 100,
|
||||
'${var.disk_utilization_forecast_algorithm}',
|
||||
${var.disk_utilization_forecast_deviations},
|
||||
interval='${var.disk_utilization_forecast_interval}',
|
||||
@ -160,7 +147,7 @@ resource "datadog_monitor" "memory_utilization" {
|
||||
|
||||
query = <<EOF
|
||||
${var.memory_utilization_time_aggregator}(${var.memory_utilization_timeframe}):
|
||||
avg:gcp.cloudsql.database.memory.utilization{${data.template_file.filter.rendered}}
|
||||
avg:gcp.cloudsql.database.memory.utilization{${var.filter_tags}}}
|
||||
by {database_id} * 100
|
||||
> ${var.memory_utilization_threshold_critical}
|
||||
EOF
|
||||
@ -205,7 +192,7 @@ resource "datadog_monitor" "memory_utilization_forecast" {
|
||||
query = <<EOF
|
||||
${var.memory_utilization_forecast_time_aggregator}(${var.memory_utilization_forecast_timeframe}):
|
||||
forecast(
|
||||
avg:gcp.cloudsql.database.memory.utilization{${data.template_file.filter.rendered}} by {database_id} * 100,
|
||||
avg:gcp.cloudsql.database.memory.utilization{${var.filter_tags}}} by {database_id} * 100,
|
||||
'${var.memory_utilization_forecast_algorithm}',
|
||||
${var.memory_utilization_forecast_deviations},
|
||||
interval='${var.memory_utilization_forecast_interval}',
|
||||
@ -254,7 +241,7 @@ resource "datadog_monitor" "failover_unavailable" {
|
||||
|
||||
query = <<EOF
|
||||
${var.failover_unavailable_time_aggregator}(${var.failover_unavailable_timeframe}):
|
||||
avg:gcp.cloudsql.database.available_for_failover{${data.template_file.filter.rendered}}
|
||||
avg:gcp.cloudsql.database.available_for_failover{${var.filter_tags}}}
|
||||
by {database_id}
|
||||
<= ${var.failover_unavailable_threshold_critical}
|
||||
EOF
|
||||
|
||||
@ -26,11 +26,9 @@ Creates DataDog monitors with the following checks:
|
||||
|------|-------------|:----:|:-----:|:-----:|
|
||||
| environment | Architecture environment | string | - | yes |
|
||||
| evaluation_delay | Delay in seconds for the metric evaluation | string | `900` | 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 |
|
||||
| filter_tags | Tags used for filtering | string | `*` | no |
|
||||
| message | Message sent when a monitor is triggered | string | - | yes |
|
||||
| new_host_delay | Delay in seconds for the new host evaluation | string | `300` | no |
|
||||
| project_id | ID of the GCP Project | string | - | yes |
|
||||
| queries_changing_anomaly_alert_window | Alert window. | string | `last_30m` | no |
|
||||
| queries_changing_anomaly_count_default_zero | Count default zero. | string | `false` | no |
|
||||
| queries_changing_anomaly_detection_algorithm | Anomaly Detection Algorithm used | string | `agile` | 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 = "*"
|
||||
}
|
||||
|
||||
@ -30,14 +25,6 @@ variable "new_host_delay" {
|
||||
default = 300
|
||||
}
|
||||
|
||||
#
|
||||
# Filter variables
|
||||
#
|
||||
variable "project_id" {
|
||||
type = "string"
|
||||
description = "ID of the GCP Project"
|
||||
}
|
||||
|
||||
#
|
||||
# Replication Lag
|
||||
#
|
||||
|
||||
@ -1,16 +1,3 @@
|
||||
#
|
||||
# FILTERS
|
||||
#
|
||||
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}"}"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Replication Lag
|
||||
#
|
||||
@ -22,7 +9,7 @@ resource "datadog_monitor" "replication_lag" {
|
||||
|
||||
query = <<EOF
|
||||
${var.replication_lag_time_aggregator}(${var.replication_lag_timeframe}):
|
||||
avg:gcp.cloudsql.database.mysql.replication.seconds_behind_master{${data.template_file.filter.rendered}}
|
||||
avg:gcp.cloudsql.database.mysql.replication.seconds_behind_master{${var.filter_tags}}
|
||||
by {database_id}
|
||||
> ${var.replication_lag_threshold_critical}
|
||||
EOF
|
||||
@ -68,7 +55,7 @@ resource "datadog_monitor" "queries_changing_anomaly" {
|
||||
query = <<EOF
|
||||
${var.queries_changing_anomaly_time_aggregator}(${var.queries_changing_anomaly_timeframe}):
|
||||
anomalies(
|
||||
avg:gcp.cloudsql.database.mysql.queries{${data.template_file.filter.rendered}} by {database_id}.as_count(),
|
||||
avg:gcp.cloudsql.database.mysql.queries{${var.filter_tags}} by {database_id}.as_count(),
|
||||
'${var.queries_changing_anomaly_detection_algorithm}',
|
||||
${var.queries_changing_anomaly_deviations},
|
||||
direction='${var.queries_changing_anomaly_direction}',
|
||||
@ -122,7 +109,7 @@ resource "datadog_monitor" "questions_changing_anomaly" {
|
||||
query = <<EOF
|
||||
${var.questions_changing_anomaly_time_aggregator}(${var.questions_changing_anomaly_timeframe}):
|
||||
anomalies(
|
||||
avg:gcp.cloudsql.database.mysql.questions{${data.template_file.filter.rendered}} by {database_id},
|
||||
avg:gcp.cloudsql.database.mysql.questions{${var.filter_tags}} by {database_id},
|
||||
'${var.questions_changing_anomaly_detection_algorithm}',
|
||||
${var.questions_changing_anomaly_deviations},
|
||||
direction='${var.questions_changing_anomaly_direction}',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user