From 4c4c24a34f42df11295ee3cd7a13b566741cfcd7 Mon Sep 17 00:00:00 2001 From: Rafael Romero Carmona Date: Thu, 2 Aug 2018 11:31:55 +0200 Subject: [PATCH] MON-224 time aggregator for all monitors --- cloud/gcp/cloud-sql/instance/README.md | 6 ++++ cloud/gcp/cloud-sql/instance/inputs.tf | 34 +++++++++++++++++++ .../instance/monitors-cloud-sql-instance.tf | 12 +++---- cloud/gcp/cloud-sql/mysql/README.md | 3 ++ cloud/gcp/cloud-sql/mysql/inputs.tf | 18 ++++++++++ .../mysql/monitors-cloudsql-mysql.tf | 6 ++-- 6 files changed, 70 insertions(+), 9 deletions(-) diff --git a/cloud/gcp/cloud-sql/instance/README.md b/cloud/gcp/cloud-sql/instance/README.md index 7d3b0b7..2a3aa54 100644 --- a/cloud/gcp/cloud-sql/instance/README.md +++ b/cloud/gcp/cloud-sql/instance/README.md @@ -32,6 +32,7 @@ Creates DataDog monitors with the following checks: | cpu_utilization_silenced | Groups to mute for GCP Cloud SQL CPU Utilization monitor | map | `` | no | | cpu_utilization_threshold_critical | CPU Utilization in percentage (critical threshold) | string | `90` | no | | cpu_utilization_threshold_warning | CPU Utilization in percentage (warning threshold) | string | `80` | no | +| cpu_utilization_time_aggregator | Time aggregator for the CPU Utilization monitor | string | `avg` | no | | cpu_utilization_timeframe | Timeframe for the CPU Utilization monitor | string | `last_15m` | no | | delay | Delay in seconds for the metric evaluation | string | `900` | no | | disk_utilization_extra_tags | Extra tags for GCP Cloud SQL CPU Utilization monitor | list | `` | no | @@ -46,17 +47,20 @@ Creates DataDog monitors with the following checks: | disk_utilization_forecast_silenced | Groups to mute for GCP Cloud SQL Disk Utilization Forecast monitor | map | `` | no | | disk_utilization_forecast_threshold_critical | Disk Utilization Forecast in percentage (critical threshold) | string | `80` | no | | disk_utilization_forecast_threshold_critical_recovery | Disk Utilization Forecast in percentage (recovery threshold) | string | `72` | no | +| disk_utilization_forecast_time_aggregator | Time aggregator for the Disk Utilization Forecast monitor | string | `max` | no | | disk_utilization_forecast_timeframe | Timeframe for the Disk Utilization Forecast monitor | string | `next_1w` | no | | disk_utilization_message | Custom message for the Disk Utilization monitor | string | `` | no | | disk_utilization_silenced | Groups to mute for GCP Cloud SQL Disk Utilization monitor | map | `` | no | | disk_utilization_threshold_critical | Disk Utilization in percentage (critical threshold) | string | `90` | no | | disk_utilization_threshold_warning | Disk Utilization in percentage (warning threshold) | string | `80` | no | +| disk_utilization_time_aggregator | Time aggregator for the Disk Utilization monitor | string | `avg` | no | | disk_utilization_timeframe | Timeframe for the Disk Utilization monitor | string | `last_5m` | no | | environment | Architecture environment | string | - | yes | | failover_unavailable_extra_tags | Extra tags for GCP Cloud SQL Failover Unavailable monitor | list | `` | no | | failover_unavailable_message | Custom message for the Failover Unavailable monitor | string | `` | no | | failover_unavailable_silenced | Groups to mute for GCP Cloud SQL Failover Unavailable monitor | map | `` | no | | 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 | @@ -72,11 +76,13 @@ Creates DataDog monitors with the following checks: | memory_utilization_forecast_silenced | Groups to mute for GCP Cloud SQL Memory Utilization Forecast monitor | map | `` | no | | memory_utilization_forecast_threshold_critical | Memory Utilization Forecast in percentage (warning threshold) | string | `90` | no | | memory_utilization_forecast_threshold_critical_recovery | Memory Utilization Forecast in percentage (recovery threshold) | string | `81` | no | +| memory_utilization_forecast_time_aggregator | Time aggregator for the Memory Utilization Forecast monitor | string | `max` | no | | memory_utilization_forecast_timeframe | Timeframe for the Memory Utilization Forecast monitor | string | `next_3d` | no | | memory_utilization_message | Custom message for the Memory Utilization monitor | string | `` | no | | memory_utilization_silenced | Groups to mute for GCP Cloud SQL Memory Utilization monitor | map | `` | no | | memory_utilization_threshold_critical | Memory Utilization in percentage (critical threshold) | string | `90` | no | | memory_utilization_threshold_warning | Memory Utilization in percentage (warning threshold) | string | `80` | no | +| memory_utilization_time_aggregator | Time aggregator for the Memory Utilization monitor | string | `avg` | no | | memory_utilization_timeframe | Timeframe for the Memory Utilization monitor | string | `last_5m` | no | | message | Message sent when a monitor is triggered | string | - | yes | | project_id | ID of the GCP Project | string | - | yes | diff --git a/cloud/gcp/cloud-sql/instance/inputs.tf b/cloud/gcp/cloud-sql/instance/inputs.tf index c83fcc9..f9e5149 100644 --- a/cloud/gcp/cloud-sql/instance/inputs.tf +++ b/cloud/gcp/cloud-sql/instance/inputs.tf @@ -43,6 +43,12 @@ variable "cpu_utilization_message" { default = "" } +variable "cpu_utilization_time_aggregator" { + description = "Time aggregator for the CPU Utilization monitor" + type = "string" + default = "avg" +} + variable "cpu_utilization_timeframe" { description = "Timeframe for the CPU Utilization monitor" type = "string" @@ -83,6 +89,12 @@ variable "disk_utilization_message" { default = "" } +variable "disk_utilization_time_aggregator" { + description = "Time aggregator for the Disk Utilization monitor" + type = "string" + default = "avg" +} + variable "disk_utilization_timeframe" { description = "Timeframe for the Disk Utilization monitor" type = "string" @@ -123,6 +135,12 @@ variable "disk_utilization_forecast_message" { default = "" } +variable "disk_utilization_forecast_time_aggregator" { + description = "Time aggregator for the Disk Utilization Forecast monitor" + type = "string" + default = "max" +} + variable "disk_utilization_forecast_timeframe" { description = "Timeframe for the Disk Utilization Forecast monitor" type = "string" @@ -198,6 +216,11 @@ variable "memory_utilization_message" { default = "" } +variable "memory_utilization_time_aggregator" { + description = "Time aggregator for the Memory Utilization monitor" + default = "avg" +} + variable "memory_utilization_timeframe" { description = "Timeframe for the Memory Utilization monitor" default = "last_5m" @@ -234,6 +257,11 @@ variable "memory_utilization_forecast_message" { default = "" } +variable "memory_utilization_forecast_time_aggregator" { + description = "Time aggregator for the Memory Utilization Forecast monitor" + default = "max" +} + variable "memory_utilization_forecast_timeframe" { description = "Timeframe for the Memory Utilization Forecast monitor" default = "next_3d" @@ -307,6 +335,12 @@ variable "failover_unavailable_message" { default = "" } +variable "failover_unavailable_time_aggregator" { + description = "Time aggreggator for the Failover Unavailable monitor" + type = "string" + default = "max" +} + variable "failover_unavailable_timeframe" { description = "Timeframe for the Failover Unavailable monitor" type = "string" diff --git a/cloud/gcp/cloud-sql/instance/monitors-cloud-sql-instance.tf b/cloud/gcp/cloud-sql/instance/monitors-cloud-sql-instance.tf index a961f89..201722a 100644 --- a/cloud/gcp/cloud-sql/instance/monitors-cloud-sql-instance.tf +++ b/cloud/gcp/cloud-sql/instance/monitors-cloud-sql-instance.tf @@ -21,7 +21,7 @@ resource "datadog_monitor" "cpu_utilization" { type = "metric alert" query = < ${var.cpu_utilization_threshold_critical} @@ -66,7 +66,7 @@ resource "datadog_monitor" "disk_utilization" { type = "metric alert" query = < ${var.disk_utilization_threshold_critical} @@ -111,7 +111,7 @@ resource "datadog_monitor" "disk_utilization_forecast" { type = "metric alert" query = < ${var.memory_utilization_threshold_critical} @@ -206,7 +206,7 @@ resource "datadog_monitor" "memory_utilization_forecast" { type = "query alert" query = <` | no | | replication_lag_message | Custom message for the Replication Lag monitor | string | `` | no | | replication_lag_silenced | Groups to mute for GCP Cloud SQL Replication Lag monitor | map | `` | no | | replication_lag_threshold_critical | Seconds behind the master (critical threshold) | string | `180` | no | | replication_lag_threshold_warning | Seconds behind the master (warning threshold) | string | `90` | no | +| replication_lag_time_aggregator | Time aggregator for the Replication Lag monitor | string | `min` | no | | replication_lag_timeframe | Timeframe for the Replication Lag monitor | string | `last_10m` | no | ## Outputs diff --git a/cloud/gcp/cloud-sql/mysql/inputs.tf b/cloud/gcp/cloud-sql/mysql/inputs.tf index 6872b23..06d2336 100644 --- a/cloud/gcp/cloud-sql/mysql/inputs.tf +++ b/cloud/gcp/cloud-sql/mysql/inputs.tf @@ -43,6 +43,12 @@ variable "replication_lag_message" { default = "" } +variable "replication_lag_time_aggregator" { + description = "Time aggregator for the Replication Lag monitor" + type = "string" + default = "min" +} + variable "replication_lag_timeframe" { description = "Timeframe for the Replication Lag monitor" type = "string" @@ -83,6 +89,12 @@ variable "queries_changing_anomaly_message" { default = "" } +variable "queries_changing_anomaly_time_aggregator" { + description = "Time aggregator for the Queries Changing mon monitor" + type = "string" + default = "avg" +} + variable "queries_changing_anomaly_timeframe" { description = "Timeframe for the Queries Changing mon monitor" type = "string" @@ -171,6 +183,12 @@ variable "questions_changing_anomaly_message" { default = "" } +variable "questions_changing_anomaly_time_aggregator" { + description = "Time aggregator for the Questions Changing monitor" + type = "string" + default = "avg" +} + variable "questions_changing_anomaly_timeframe" { description = "Timeframe for the Questions Changing monitor" type = "string" diff --git a/cloud/gcp/cloud-sql/mysql/monitors-cloudsql-mysql.tf b/cloud/gcp/cloud-sql/mysql/monitors-cloudsql-mysql.tf index 2c360cf..d6860ab 100644 --- a/cloud/gcp/cloud-sql/mysql/monitors-cloudsql-mysql.tf +++ b/cloud/gcp/cloud-sql/mysql/monitors-cloudsql-mysql.tf @@ -21,7 +21,7 @@ resource "datadog_monitor" "replication_lag" { type = "metric alert" query = < ${var.replication_lag_threshold_critical} @@ -67,7 +67,7 @@ resource "datadog_monitor" "queries_changing_anomaly" { type = "query alert" query = <