From 258a70e9c09e3aea3be255e4eb040dc96edede8a Mon Sep 17 00:00:00 2001 From: Laurent Piroelle Date: Mon, 17 Dec 2018 17:42:57 +0100 Subject: [PATCH] MON-377 Azure SQL Server status --- cloud/azure/sql-database/README.md | 8 +++++ cloud/azure/sql-database/inputs.tf | 36 +++++++++++++++++++ .../monitors-sql-database-basics.tf | 28 +++++++++++++++ cloud/azure/sql-database/outputs.tf | 5 +++ 4 files changed, 77 insertions(+) diff --git a/cloud/azure/sql-database/README.md b/cloud/azure/sql-database/README.md index 71548ac..5d8e8a4 100644 --- a/cloud/azure/sql-database/README.md +++ b/cloud/azure/sql-database/README.md @@ -19,6 +19,7 @@ Creates DataDog monitors with the following checks: - SQL Database CPU too high - SQL Database Deadlocks too high - SQL Database DTU Consumption too high +- SQL Database is down - SQL Database low free space ## Inputs @@ -62,6 +63,12 @@ Creates DataDog monitors with the following checks: | filter_tags_use_defaults | Use default filter tags convention | string | `true` | no | | message | Message sent when an alert is triggered | string | - | yes | | new_host_delay | Delay in seconds before monitor new resource | string | `300` | no | +| status_enabled | Flag to enable Redis status monitor | string | `true` | no | +| status_extra_tags | Extra tags for Redis status monitor | list | `[]` | no | +| status_message | Custom message for Redis status monitor | string | `` | no | +| status_silenced | Groups to mute for Redis status monitor | map | `{}` | no | +| status_time_aggregator | Monitor aggregator for Redis status [available values: min, max or avg] | string | `max` | no | +| status_timeframe | Monitor timeframe for Redis status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_5m` | no | ## Outputs @@ -71,6 +78,7 @@ Creates DataDog monitors with the following checks: | sql-database_deadlocks_count_id | id for monitor sql-database_deadlocks_count | | sql-database_dtu_consumption_high_id | id for monitor sql-database_dtu_consumption_high | | sql-database_free_space_low_id | id for monitor sql-database_free_space_low | +| status_id | id for monitor status | ## Related documentation diff --git a/cloud/azure/sql-database/inputs.tf b/cloud/azure/sql-database/inputs.tf index ed18d7b..e2c211c 100644 --- a/cloud/azure/sql-database/inputs.tf +++ b/cloud/azure/sql-database/inputs.tf @@ -35,6 +35,42 @@ variable "filter_tags_custom_excluded" { } # Azure SQL Database specific variables +variable "status_silenced" { + description = "Groups to mute for Redis status monitor" + type = "map" + default = {} +} + +variable "status_enabled" { + description = "Flag to enable Redis status monitor" + type = "string" + default = "true" +} + +variable "status_extra_tags" { + description = "Extra tags for Redis status monitor" + type = "list" + default = [] +} + +variable "status_message" { + description = "Custom message for Redis status monitor" + type = "string" + default = "" +} + +variable "status_time_aggregator" { + description = "Monitor aggregator for Redis status [available values: min, max or avg]" + type = "string" + default = "max" +} + +variable "status_timeframe" { + description = "Monitor timeframe for Redis status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" + type = "string" + default = "last_5m" +} + variable "cpu_silenced" { description = "Groups to mute for SQL CPU monitor" type = "map" diff --git a/cloud/azure/sql-database/monitors-sql-database-basics.tf b/cloud/azure/sql-database/monitors-sql-database-basics.tf index a3cdfe1..44e6021 100644 --- a/cloud/azure/sql-database/monitors-sql-database-basics.tf +++ b/cloud/azure/sql-database/monitors-sql-database-basics.tf @@ -1,3 +1,31 @@ +resource "datadog_monitor" "status" { + count = "${var.status_enabled ? 1 : 0}" + name = "[${var.environment}] SQL Database is down" + message = "${coalesce(var.status_message, var.message)}" + + query = <