diff --git a/OOM_error-variables.tf b/OOM_error-variables.tf new file mode 100644 index 0000000..9eff96a --- /dev/null +++ b/OOM_error-variables.tf @@ -0,0 +1,52 @@ +variable "oom_error_enabled" { + type = bool + default = true + description = "oom_error in redis" +} + +variable "oom_error_warning" { + type = number + default = 1 + # 1 oom_errors +} + +variable "oom_error_critical" { + type = number + default = 5 + # 5 oom_errors +} + +variable "oom_error_evaluation_period" { + type = string + default = "last_5m" +} + +variable "oom_error_severity" { + type = string + default = "critical" +} + +variable "oom_error_note" { + type = string + default = "" +} + +variable "oom_error_docs" { + type = string + default = "" +} + +variable "oom_error_filter_override" { + type = string + default = "" +} + +variable "oom_error_alerting_enabled" { + type = bool + default = true +} + +variable "type" { + type = string + default = "log alert" +} \ No newline at end of file diff --git a/OOM_error.tf b/OOM_error.tf new file mode 100644 index 0000000..d5d712a --- /dev/null +++ b/OOM_error.tf @@ -0,0 +1,39 @@ +locals { + oom_error_filter = coalesce( + var.oom_error_filter_override, + var.filter_str + ) +} + +module "redis_oom_error" { + source = "git@github.com:kabisa/terraform-datadog-generic-monitor.git?ref=0.5" + + name = "Out Of Memory errors in the logs" + query = "logs(\"OOM command not allowed when used memory \\> 'maxmemory'.\").index(\"*\").rollup(\"count\").last(\"15m\") > ${var.oom_error_critical}" + + enabled = var.oom_error_enabled + alerting_enabled = var.oom_error_alerting_enabled + + alert_message = <= 1", +# "message": "{{#is_alert}}\nOperations per second on Redis has an anomaly {{value}}\n{{/is_alert}}\n{{#is_recovery}}\nOperations per second on Redis has recovered {{value}}\n{{/is_recovery}}\n@pagerduty-VacanSoleil", +# "tags": [ +# "env:prd", +# "service:Redis", +# "severity:critical" +# ], +# "options": { +# "notify_audit": false, +# "locked": true, +# "timeout_h": 0, +# "silenced": {}, +# "include_tags": true, +# "no_data_timeframe": null, +# "require_full_window": true, +# "new_host_delay": 300, +# "notify_no_data": false, +# "renotify_interval": 0, +# "escalation_message": "", +# "threshold_windows": { +# "recovery_window": "last_5m", +# "trigger_window": "last_14d" +# }, +# "thresholds": { +# "critical": 1, +# "critical_recovery": 0 +# } +# }, +# "priority": null +# } \ No newline at end of file diff --git a/variables.tf b/variables.tf new file mode 100644 index 0000000..3ade737 --- /dev/null +++ b/variables.tf @@ -0,0 +1,30 @@ +variable "env" { + type = string +} + +variable "alert_env" { + type = string +} + +variable "service" { + type = string + default = "Redis" +} + +variable "notification_channel" { + type = string +} + +variable "additional_tags" { + type = list(string) + default = [] +} + +variable "filter_str" { + type = string +} + +variable "locked" { + type = bool + default = true +}