diff --git a/scripts/02_update_readme.sh b/scripts/02_update_readme.sh index 1c88a3b..56db16b 100755 --- a/scripts/02_update_readme.sh +++ b/scripts/02_update_readme.sh @@ -55,7 +55,7 @@ EOF IFS=$(echo -en "\n\b") for match in $(grep -E ^[[:space:]]+name[[:space:]]+= $(basename ${path})); do name=$(get_name "${match}") - echo "- $name" >> README.md + echo "- ${name/could reach/forecast}" >> README.md done IFS=$SAVEIFS terraform-docs md ./ >> README.md diff --git a/system/generic/README.md b/system/generic/README.md index 150891a..5ab7477 100644 --- a/system/generic/README.md +++ b/system/generic/README.md @@ -19,6 +19,7 @@ Creates DataDog monitors with the following checks: - CPU usage - CPU load 5 - Free disk space +- Disk Space forecast - Free disk inodes - Free memory @@ -52,6 +53,19 @@ Creates DataDog monitors with the following checks: | free_disk_inodes_time_aggregator | Monitor aggregator for Free disk inodes [available values: min, max or avg] | string | `min` | no | | free_disk_inodes_timeframe | Monitor timeframe for Free disk inodes [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_5m` | no | | free_disk_space_extra_tags | Extra tags for Free diskspace monitor | list | `` | no | +| free_disk_space_forecast_algorithm | Algorithm for the Free diskspace Forecast monitor [available values: `linear` or `seasonal`] | string | `linear` | no | +| free_disk_space_forecast_deviations | Deviations for the Free diskspace Forecast monitor [available values: `1`, `2`, `3`, `4` or `5`] | string | `1` | no | +| free_disk_space_forecast_extra_tags | Extra tags for Free diskspace forecast monitor | list | `` | no | +| free_disk_space_forecast_interval | Interval for the Free diskspace Forecast monitor [available values: `30m`, `60m` or `120m`] | string | `60m` | no | +| free_disk_space_forecast_linear_history | History for the Free diskspace Forecast monitor [available values: `12h`, `#d` (1, 2, or 3), `#w` (1, or 2) or `#mo` (1, 2 or 3)] | string | `1w` | no | +| free_disk_space_forecast_linear_model | Model for the Free diskspace Forecast monitor [available values: `default`, `simple` or `reactive`] | string | `default` | no | +| free_disk_space_forecast_message | Custom message for Free diskspace forecast monitor | string | `` | no | +| free_disk_space_forecast_seasonal_seasonality | Seasonality for the Free diskspace Forecast monitor | string | `weekly` | no | +| free_disk_space_forecast_silenced | Groups to mute for Free diskspace forecast monitor | map | `` | no | +| free_disk_space_forecast_threshold_critical | Free disk space forecast critical threshold | string | `80` | no | +| free_disk_space_forecast_threshold_critical_recovery | Free disk space forecast recovery threshold | string | `72` | no | +| free_disk_space_forecast_time_aggregator | Monitor aggregator for Free diskspace forecast [available values: min, max or avg] | string | `max` | no | +| free_disk_space_forecast_timeframe | Monitor timeframe for Free diskspace forecast [available values: `next_12h`, `next_#d` (1, 2, or 3), `next_#w` (1 or 2) or `next_#mo` (1, 2 or 3)] | string | `next_1w` | no | | free_disk_space_message | Custom message for Free diskspace monitor | string | `` | no | | free_disk_space_silenced | Groups to mute for Free diskspace monitor | map | `` | no | | free_disk_space_threshold_critical | Free disk space critical threshold | string | `10` | no | @@ -73,6 +87,7 @@ Creates DataDog monitors with the following checks: | Name | Description | |------|-------------| | datadog_cpu_too_high_id | id for monitor datadog_cpu_too_high | +| datadog_free_disk_space_forecast_id | id for monitor datadog_free_disk_space_forecast | | datadog_free_disk_space_inodes_too_low_id | id for monitor datadog_free_disk_space_inodes_too_low | | datadog_free_disk_space_too_low_id | id for monitor datadog_free_disk_space_too_low | | datadog_free_memory_id | id for monitor datadog_free_memory | diff --git a/system/generic/inputs.tf b/system/generic/inputs.tf index 7405b07..8575ed1 100644 --- a/system/generic/inputs.tf +++ b/system/generic/inputs.tf @@ -151,6 +151,82 @@ variable "free_disk_space_threshold_critical" { default = 10 } +variable "free_disk_space_forecast_silenced" { + description = "Groups to mute for Free diskspace forecast monitor" + type = "map" + default = {} +} + +variable "free_disk_space_forecast_extra_tags" { + description = "Extra tags for Free diskspace forecast monitor" + type = "list" + default = [] +} + +variable "free_disk_space_forecast_message" { + description = "Custom message for Free diskspace forecast monitor" + type = "string" + default = "" +} + +variable "free_disk_space_forecast_time_aggregator" { + description = "Monitor aggregator for Free diskspace forecast [available values: min, max or avg]" + type = "string" + default = "max" +} + +variable "free_disk_space_forecast_timeframe" { + description = "Monitor timeframe for Free diskspace forecast [available values: `next_12h`, `next_#d` (1, 2, or 3), `next_#w` (1 or 2) or `next_#mo` (1, 2 or 3)]" + type = "string" + default = "next_1w" +} + +variable "free_disk_space_forecast_algorithm" { + description = "Algorithm for the Free diskspace Forecast monitor [available values: `linear` or `seasonal`]" + type = "string" + default = "linear" +} + +variable "free_disk_space_forecast_deviations" { + description = "Deviations for the Free diskspace Forecast monitor [available values: `1`, `2`, `3`, `4` or `5`]" + type = "string" + default = 1 +} + +variable "free_disk_space_forecast_interval" { + description = "Interval for the Free diskspace Forecast monitor [available values: `30m`, `60m` or `120m`]" + type = "string" + default = "60m" +} + +variable "free_disk_space_forecast_linear_history" { + description = "History for the Free diskspace Forecast monitor [available values: `12h`, `#d` (1, 2, or 3), `#w` (1, or 2) or `#mo` (1, 2 or 3)]" + type = "string" + default = "1w" +} + +variable "free_disk_space_forecast_linear_model" { + description = "Model for the Free diskspace Forecast monitor [available values: `default`, `simple` or `reactive`]" + type = "string" + default = "default" +} + +variable "free_disk_space_forecast_seasonal_seasonality" { + description = "Seasonality for the Free diskspace Forecast monitor" + type = "string" + default = "weekly" +} + +variable "free_disk_space_forecast_threshold_critical_recovery" { + description = "Free disk space forecast recovery threshold" + default = 72 +} + +variable "free_disk_space_forecast_threshold_critical" { + description = "Free disk space forecast critical threshold" + default = 80 +} + variable "free_disk_inodes_silenced" { description = "Groups to mute for Free disk inodes monitor" type = "map" diff --git a/system/generic/monitors-system.tf b/system/generic/monitors-system.tf index 4d0374b..89db0c4 100644 --- a/system/generic/monitors-system.tf +++ b/system/generic/monitors-system.tf @@ -93,6 +93,45 @@ resource "datadog_monitor" "datadog_free_disk_space_too_low" { tags = ["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform", "${var.free_disk_space_extra_tags}"] } +resource "datadog_monitor" "datadog_free_disk_space_forecast" { + name = "[${var.environment}] Disk Space could reach {{#is_alert}}{{threshold}}%{{/is_alert}} in a near future" + message = "${coalesce(var.free_disk_space_forecast_message, var.message)}" + + query = <= ${var.free_disk_space_forecast_threshold_critical} + EOF + + type = "query alert" + + thresholds { + critical_recovery = "${var.free_disk_space_forecast_threshold_critical_recovery}" + critical = "${var.free_disk_space_forecast_threshold_critical}" + } + + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true + require_full_window = true + notify_no_data = false + renotify_interval = 0 + + evaluation_delay = "${var.evaluation_delay}" + new_host_delay = "${var.new_host_delay}" + + silenced = "${var.free_disk_space_forecast_silenced}" + + tags = ["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform", "${var.free_disk_space_forecast_extra_tags}"] +} + resource "datadog_monitor" "datadog_free_disk_space_inodes_too_low" { name = "[${var.environment}] Free disk inodes {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.free_disk_inodes_message, var.message)}" diff --git a/system/generic/outputs.tf b/system/generic/outputs.tf index daf231f..85492d8 100644 --- a/system/generic/outputs.tf +++ b/system/generic/outputs.tf @@ -13,6 +13,11 @@ output "datadog_free_disk_space_too_low_id" { value = "${datadog_monitor.datadog_free_disk_space_too_low.id}" } +output "datadog_free_disk_space_forecast_id" { + description = "id for monitor datadog_free_disk_space_forecast" + value = "${datadog_monitor.datadog_free_disk_space_forecast.id}" +} + output "datadog_free_disk_space_inodes_too_low_id" { description = "id for monitor datadog_free_disk_space_inodes_too_low" value = "${datadog_monitor.datadog_free_disk_space_inodes_too_low.id}"