diff --git a/cloud/azure/virtual-machine/inputs.tf b/cloud/azure/virtual-machine/inputs.tf index 8072d8d..6b2d91d 100644 --- a/cloud/azure/virtual-machine/inputs.tf +++ b/cloud/azure/virtual-machine/inputs.tf @@ -191,41 +191,41 @@ variable "ram_reserved_threshold_critical" { default = 95 } -variable "free_disk_space_low_enabled" { +variable "disk_space_enabled" { description = "Flag to enable Virtual Machine status monitor" type = string default = "true" } -variable "free_disk_space_low_time_aggregator" { +variable "disk_space_time_aggregator" { description = "Monitor aggregator for Virtual Machine free disk space [available values: min, max or avg]" type = string default = "avg" } -variable "free_disk_space_low_timeframe" { +variable "disk_space_timeframe" { description = "Monitor timeframe for Virtual Machine free disk space too low [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" type = string default = "last_15m" } -variable "free_disk_space_low_threshold_critical" { +variable "disk_space_threshold_critical" { description = "Virtual Machine free disk space in percent (critical threshold)" - default = "5" + default = "95" } -variable "free_disk_space_low_threshold_warning" { +variable "disk_space_threshold_warning" { description = "Virtual Machine free disk space in percent (warning threshold)" - default = "10" + default = "90" } -variable "free_disk_space_low_extra_tags" { +variable "disk_space_extra_tags" { description = "Extra tags for Virtual Machine free disk space monitor" type = list(string) default = [] } -variable "free_disk_space_low_message" { +variable "disk_space_message" { description = "Custom message for Virtual Machine CPU free disk space monitor" type = string default = "" diff --git a/cloud/azure/virtual-machine/monitors-virtual-machine.tf b/cloud/azure/virtual-machine/monitors-virtual-machine.tf index 5e77413..78774af 100644 --- a/cloud/azure/virtual-machine/monitors-virtual-machine.tf +++ b/cloud/azure/virtual-machine/monitors-virtual-machine.tf @@ -134,21 +134,21 @@ EOQ } } -resource "datadog_monitor" "virtualmachine_free_disk_space_low" { - count = var.free_disk_space_low_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Virtual Machine disk space too low {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = coalesce(var.free_disk_space_low_message, var.message) +resource "datadog_monitor" "virtualmachine_disk_space" { + count = var.disk_space_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Virtual Machine disk space {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.disk_space_message, var.message) type = "query alert" query = < ${var.disk_space_threshold_critical} EOQ thresholds = { - warning = var.free_disk_space_low_threshold_warning - critical = var.free_disk_space_low_threshold_critical + warning = var.disk_space_threshold_warning + critical = var.disk_space_threshold_critical } evaluation_delay = var.evaluation_delay @@ -161,7 +161,7 @@ EOQ locked = false require_full_window = false - tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:virtualmachine", "team:claranet", "created-by:terraform"], var.free_disk_space_low_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:virtualmachine", "team:claranet", "created-by:terraform"], var.disk_space_extra_tags) lifecycle { ignore_changes = ["silenced"]